Invalid option errors running shell script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Invalid option errors running shell script
# 1  
Old 03-06-2012
Question Invalid option errors running shell script

The script below fails with the following error messages:
gzip: invalid option -- 'w'
Try `gzip --help' for more information.
mysqldump: Got errno 32 on write
cp: invalid option -- 'w'
Try `cp --help' for more information.
rm: invalid option -- 'w'
Try `rm --help' for more information.

Here's the script:

#!/bin/bash
nice -n 19 mysqldump --user=root --password=0@9fI6qukyBY --all-databases -c | nice -n 19 gzip -9 > /home/tech/'date +%Y%m%d' -wikibackup.tar.gz
cp /home/tech/'date +%Y%m%d' -wikibackup.tar.gz /mnt/dathomir
rm /home/tech/'date +%Y%m%d' -wikibackup.tar.gz

I thought that would be a common enough error message that I could quickly google an answer but I have had no luck. I appreciate any insight. Thanks!
# 2  
Old 03-06-2012
Well you have bigger issues as it seems you posted your root password for all to see!

I think you intended backquotes around your date command, not single quotes and I would highly recommend you do not start a filename with a dash, most every command you try to pass that as an arg to will think you are specifying an option, hence all the -w errors on every command.

Change that root password ASAP!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find invalid URL in a text file using shell script?

How to find and remove invalid URLs in a text file using shell script? (1 Reply)
Discussion started by: vel4ever
1 Replies

2. HP-UX

top -l 1 invalid option.

Hi, I am using below command to get the High CPU Utilization. top -l 1| awk ‘/CPU usage/ {print $12, $13}’ I am getting below error. ksh: 1: parameter not set top: illegal option -- l Usage: top Usage: awk ... Could you please suggest the appropriate solution. ... (3 Replies)
Discussion started by: wahab
3 Replies

3. Shell Programming and Scripting

Command not found errors when running csh script

I am trying to find the number of files whose name starts with uni. Below is the code but it is giving error. :confused: #!/bin/csh FILES_NAME ='files_list'; FILE_NAME_PATTERN = 'uni*'; NO_OF_FILES; ls -l $FILE_NAME_PATTERN > $FILES_NAME ; NO_OF_FILES = `wc -l $FILES_NAME`; echo... (3 Replies)
Discussion started by: hiten.r.chauhan
3 Replies

4. Shell Programming and Scripting

getopt invalid option selection

What is the significance of the *) and ?) in the below code. while getopts a:b:c:he opt do case $opt in a) _name="$OPTARG";; b) _project="$OPTARG";; c) line="$OPTARG";; e) _cmd="XX";; h) Projects=1;; *) echo "$OPTARG is an invalid option"; my_exit 1;; ?)... (3 Replies)
Discussion started by: posix
3 Replies

5. Shell Programming and Scripting

surpressing errors while running script

I have written shell script to find out pairsuspends in our environment.But when i run the script iam getting an error for the Pair which are not active.Below are the error am getting pairvolchk -g up1012 -I11 pairvolchk : execution error. pairvolchk: Unmatched CTGID within the group Refer... (3 Replies)
Discussion started by: zeebala1981
3 Replies

6. Shell Programming and Scripting

Compilation errors in running configure script

Hi all, I tried to cross compile Ghostscript-8.54 source. I am getting some errors during cross compilation. I have pasted the errors below. CC=arm-unknown-linux-gnu-gcc LD=arm-unknown-linux-gnu-ld ./configure --host=i686-pc-linux-gnu --target=arm-unknown-linux-gnu --without-x && make ... (2 Replies)
Discussion started by: siva4ever
2 Replies

7. Shell Programming and Scripting

writing shell script to find line of invalid characters

Hi, I have to write s script to check an input file for invalid characters. In this script I have to find the exact line of the invalid character. If the input file contain 2 invalid character sat line 10 and 17, the script will show the value 10 and 17. Any help is appreciated. (3 Replies)
Discussion started by: beginner82
3 Replies

8. Shell Programming and Scripting

Shell Script Menus - Rejecting invalid input (KSH)

Greetings all, I'm currently writing a shell script menu which is dynamically populated from an array. Have a question to ask about the filtering of invalid input. I'm using KSH. A brief description of my algorithm is as follows: 1) Read in input from user and store in a variable. (a valid... (2 Replies)
Discussion started by: rockysfr
2 Replies

9. Solaris

ps: 65535 is an invalid non-numeric argument for -p option

I want to figure out what is the reason of error message I have in Solaris 10. Why Solaris 10 dosn't recognize 65535? ps: 65535 is an invalid non-numeric argument for -p option usage: ps 'format' is one or more of: Thank you (5 Replies)
Discussion started by: gogogo
5 Replies

10. Shell Programming and Scripting

Problem with shell script...ORA-00904:invalid identifier

Guys, Please suggest me what's wrong with this script? #!/usr/bin/sh ############################################################################## # Author : Bhagat Singh # # # Date : Nov 13,2006 #... (12 Replies)
Discussion started by: bhagat.singh-j
12 Replies
Login or Register to Ask a Question