|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Please help with simple shell script
Hello,
I cannot seem to get this script to work, I assume it has something to do with the redirection? Please help... #!/bin/sh # little script to connect # to MySQL and restore a backup # variables MYSQL='/usr/local/bin/mysql'; USER='joe'; if [ "$1" = '' ] then echo 'usage: mysqlrestore <database> <mysqldump>'; elif [ "$2" = '' ] then echo 'usage: mysqlrestore <database> <mysqldump>'; elif [ ! -f $2 ] then echo 'error: '$2' not found'; else DATABASE=$1 BACKUP=$2; # create command COMMAND="$MYSQL -u $USER -p $DATABASE < $BACKUP"; # execute command $COMMAND; fi |
|
#2
|
|||
|
|||
|
probably you need to escape the "<" -> "\<" or use single quotes.
i use one of these ways, they both work: Code:
# create command COMMAND="$MYSQL -u $USER -p $DATABASE"; # execute command $COMMAND < $BACKUP; # you could also use "cat $BACKUP|$COMMAND" fi
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
||||
|
||||
|
PLEASE don't cross-post, it's rude.
|
|
#4
|
|||
|
|||
|
Vielen Dank M. Hirsch,
das hat direkt geklappt. Ich hatte mir doch schon gedacht dass es etwas mit dem < Zeichen zu tun hatte. Übrigens: mein Gott sind die Leute hier empfindlich wenn man einmal einen post in zwei Foren macht, ist ja unglaublich. Ich verspreche ich mache es nie wieder... Nochmals Danke, das war eine gute Hilfe! DrTebi |
|
#5
|
|||
|
|||
|
First you cross-post then you post in another language,thats also very rude,most people can't understand german (not that its bothers me in any way,since I understand german and its my favorite language
). |
|
#6
|
|||
|
|||
|
hey, drtebi, let everyone here take part in our conversation
![]() and cross-posting is considered bad habit in any bbs and newsgroup that i visited. so please, just don´t. we are one community here... an international one. have phun - linux is ![]() |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Please help with simple shell script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|