Can someone help me with the modifying this Unix Scripting?
echo "Please choose a folder or file. If you choose a folder you will move into that folder. Enter nothing to exit." read choice if [ "$choice" != "" ]; then if [ -f $choice ]; then echo "$choice options:" echo "Type hide to hide file." echo "Type copypro to copy protect." echo "Type read to set ready only." echo "Type copy to copy a file from one directory to another." echo "Type exit to choose a different file." read op case "$op" in hide) mv "$choice"".$choice" copy) copypro) chmod 333 "$choice" read) chmod 555 "$choice" exit) exit *) # code for error esac else cd $choice fi fi |
At first glance, it looks like you ignored a lot of the questions and comments and simply re-posted your script.
Regardless---looking at the code above: What is the question? Have you run it? What does it do? |
Try reading the following:
http://tldp.org/LDP/abs/html/testbranch.html#EX29 This may highlight where you are going wrong with the syntax of your case statement. |
Hello,
I know that I have little time to submit this project. The references that I'm referring to is Sam Teach yourself Shell Programming in 24 hours and this link http://steve-parker.org/sh/escape.shtml. I guess I have read this material, and hope to do this project myself, but thanks for help on this. If you anybody can provide more help on this, it would great. Thanks Deven |
You must seperate arguments to mv with a space character.
Each section of your case statement must be completed by ;; |
Hello,
Based upon what the project is asking for Create your own shell that will allow you to change file status and copy from one directory to another. The above script that provide does that provide the solution to Project 3. Or the script is more in depth, and what professor provided. Thanks Deven |
There is no way that you could be expected to create your own shell, we can only assume that you are being asked to create a script that asks for file/directory names and process based on this.
Code:
f_print_msg{ |
Can anybody look over this error, I check that line in the script. Can someone tell me what command that goes there?
Thanks Code:
f_print_msg{ Code:
Deven@localhost Project]$ ./Project3 |
Sorry, I posted without testing.
It's been a while since I wrote a function in shell. Should have been: Code:
f_print_msg() |
Hello,
I'm getting same error message as before, can someone can help with project? Thanks Deven |
I'm not following the details here......2 general suggestions:
1. Test your code in small pieces---for example, does it correcty run the function "f_print_message". 2. Put echo statements at key locations so you can see where the script is when it fails. |
put set -x into your script and run again. This will produce diagnostics and you can see where it goes wrong. put in some effort on your part. this is your project after all.
|
Since I'm at work, and there no Linux machine for me check right now. I have wait until, I get home.
|
After I ran this script I got this error message with the modifying the code
Code:
f_print_msg{ Code:
root@localhost Project]# ./Project3 |
I've just corrected the syntax. The rest of the program is for you to check.
Code:
#!/bin/bash |
All times are GMT -5. The time now is 06:10 AM. |