I thought I would learn shell scripting by trying something simple, but it hasn't turned out that way.
My plan is to use the wc command within my script to print some stats.
if my script is script1, and I have a file myprog.c, then ./myscript myprog.c would print:
File: myprog.c
Lines: 16
Code:
#!/bin/sh
printf "File: %s\n" $1
var=`wc -l $1`
printf "Lines: %s\n" $var
I get this as output:
File: myprog.c
./myscript: 4: 16: not found
im guessing that I can't use the $1 within the backwards quotes, but I need that wc command to run on whatever file I pass as an argument. Any help would be appreciated.