tags:

views:

44

answers:

1

I have a bash script that looks like this (called job_result.sh):

#!/bin/bash
$* && zenity --title "Job result" --info --text "SUCSESS: Job '$*'completed" && while pidof zenity > /dev/null; do /usr/bin/wmctrl -a "Job Result" && sleep 2; done

When i execute it with:

$ ./job_result.sh echo "arf" && sleep 10

I want the following to happen:

$ echo "arf" && sleep 10 && zenity --title "Job result" --info --text "SUCSESS: Job '$*'completed" && while pidof zenity > /dev/null; do /usr/bin/wmctrl -a "Job Result" && sleep 2; done

But it seems the following is happening:

$ echo "arf" && zenity --title "Job result" --info --text "SUCSESS: Job '$*'completed" && while pidof zenity > /dev/null; do /usr/bin/wmctrl -a "Job Result" && sleep 2; done

Question: How do i get hold of the entire shell argument? And not just the part until &&?

+1  A: 

try putting quotes

$ ./job_result.sh "echo 'arf' && sleep 10"

here's a guess of what you want, and can do

put your parameters in a variable in another file. then when you want to use it, source the file eg

$ cat my_shell_libraries
export var="echo 'arf' && sleep 10"
$ . my_shell_libraries
$ ./job_result.sh $var
ghostdog74
do you run this script manually everytime? or is it going to be scheduled as cron job?
ghostdog74
Manually.I intend to use it as a wrapper for jobs that takes longer than 1 minute. Like mm -b in $ANDROID_ROOT.
Any ideas? I can't figure it out... iv'e tried googleing alot since (and before) my original post...