Write script which will get filename as parameter
and will show file rights for
current user (rwx rights). Filename should be
given as parameter in command line.
Script should check if this parameter is given.I need help about this question..! Thanks
Here's a script I wrote as an assignment while doing a UNIX course. It's not exactly what you're looking for, but, if you copy and paste it into a script you can see how it runs and then make the necessary changes to show what's required for your homework question: #!/bin/sh if [ $# -eq 0 -o $# -gt 1 ] then echo "Usage: $0 ordinary_file" exit 1 fi if [ -f "$1" ] then if [ -s "$1" ] then filename="$1" set `ls -iol $filename` echo "Filename: $filename Size: $1 No. of Hard Links: $3 Owner: $4 Date last modified: $8/$9" else filename="$1" echo "Zero byte file (empty) - deleting file" rm -f $filename exit 2 fi else usage "$0: arguement must be an ordinary file" fi exit 0
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |