Results 1 to 2 of 2
Hi! Everyone, How can i write the following two problems in bash script, can anyone help. Thank you.
1. Write a short script that tells you whether the permissions for ...
- 04-14-2008 #1Just Joined!
- Join Date
- Apr 2008
- Posts
- 1
Two shell script problem, can anyone help?
Hi! Everyone, How can i write the following two problems in bash script, can anyone help. Thank you.
1. Write a short script that tells you whether the permissions for two files, whose names are given as arguments to the script, are identical. If the permissions for the two files are identical, output the common permission field. Otherwise, output each filename followed by its permission field. (Hint: Try using the cut utility.)
I know if i use this script in the following, i can get permission for the file count.txt, but i am not sure how to write this entire problem, can anyone help, thank you.
ls -l count.txt | cut -c2-10
2. Write a script that takes a colon-separated list of items and outputs the items, one per line, to standard output (without the colons).
- 04-14-2008 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
assign the result to a variable. Do the same for the other file. Then compare the variables with the if/else control statement.
See here and look for tr (one of the ways). I have helped with your homework. The rest is up to you. read the documentation2. Write a script that takes a colon-separated list of items and outputs the items, one per line, to standard output (without the colons).


Reply With Quote
