| | |
command line arguments problem.
![]() |
•
•
Join Date: Feb 2006
Posts: 2
Reputation:
Solved Threads: 0
Hello all,
Essentially a newbie to shell scripting (and Unix/Linux as a whole!) Essentially doing this project for my year in work placement. Essentially it is a script which searches for specific files and backs them up to tape. However I need to modify said script so it can verify that it has all the files that it needs before writing to tape.
However before I can do that I need to go and write an if loop that includes a command line argument so I can run the script in test mode and prevent it to write to tape so I can test the file checking feature.
Now I'm in sixes and sevens in trying to work out how to get this loop to work. I'll post the actual loop in code at first but if you need the entire code I'll have to do some er *alterations* (hush hush you see):
Now whenever I save that and try and excecute it, it comes up with...
It then goes straight to trying to back up to tape. On this machine however there is no tape drive so it can't find it so it collapses xD
Can anyone help me?
Essentially a newbie to shell scripting (and Unix/Linux as a whole!) Essentially doing this project for my year in work placement. Essentially it is a script which searches for specific files and backs them up to tape. However I need to modify said script so it can verify that it has all the files that it needs before writing to tape.
However before I can do that I need to go and write an if loop that includes a command line argument so I can run the script in test mode and prevent it to write to tape so I can test the file checking feature.
Now I'm in sixes and sevens in trying to work out how to get this loop to work. I'll post the actual loop in code at first but if you need the entire code I'll have to do some er *alterations* (hush hush you see):
•
•
•
•
if [ $# -test 0 ]; then
echo @skipping tape dump - diagnostic test mode@
else
tar tf $tapedevice
fi
•
•
•
•
./test5.sh: line 27 [: -test: binary operator expected
Can anyone help me?
•
•
Join Date: May 2004
Posts: 178
Reputation:
Solved Threads: 10
Shell Scripting Syntax (Toggle Plain Text)
#!/bin/ksh if [ $# -eq 0 ]; then echo "$# is zero " else echo "$# is greater than zero" fi
![]() |
Similar Threads
- Command Line Arguments (C#)
- command line arguments help (C)
- To fetch data through command line arguments (C++)
- HELP!!!need help with command line arguments and creating a package in java. HELP!!!! (Java)
- command line arguments (C++)
- Command-line Arguments. (C++)
Other Threads in the Shell Scripting Forum
- Previous Thread: shell script for number sequence--- anybody help me?
- Next Thread: A wierd problem
| Thread Tools | Search this Thread |






