I am attempting to create a script that will
1)Ask for the name of a file
2)Verify that the file is readable
3)If the file d/n exist or is not readable, issue an error message of some sort
4)print the file that has been sorted.
I am not sure if I should declare a variable for the file or not.
name=address.data
>
> echo "What is the name of the file? "
>
> if [ -f $name ]
> read name
>
> then sort +8n +0 +1 $filename > address.sort
> awk '{print $1, $2
> print $3, $4, $5
> print $6, $7, $8, $9
> print " "
> print " "}' data.sort
>
> else
> echo "file doesnot exit"
>
This just sits there an looks at me....I input the correct filename or an incorrect one, does nothing...please help
1)Ask for the name of a file
2)Verify that the file is readable
3)If the file d/n exist or is not readable, issue an error message of some sort
4)print the file that has been sorted.
I am not sure if I should declare a variable for the file or not.
name=address.data
>
> echo "What is the name of the file? "
>
> if [ -f $name ]
> read name
>
> then sort +8n +0 +1 $filename > address.sort
> awk '{print $1, $2
> print $3, $4, $5
> print $6, $7, $8, $9
> print " "
> print " "}' data.sort
>
> else
> echo "file doesnot exit"
>
This just sits there an looks at me....I input the correct filename or an incorrect one, does nothing...please help