This is not quite working right.
#!/bin/bash
[ ! $1 ] && {
echo -e "Error!! No time given.!!"; exit 1; }
seamonkey
sleep $1
killall seamonkey
This is not quite working right.
#!/bin/bash
[ ! $1 ] && {
echo -e "Error!! No time given.!!"; exit 1; }
seamonkey
sleep $1
killall seamonkey
created a file called fix, made it executable (chmod u+x fix)
#!/bin/bash
#
if [ $# -eq 0 ]; then
echo "Error! no time given."
exit 1
fi
echo "doing something ..."
sleep $1
echo "I slept for ..." $1
echo "Goodbye."
user@bionic:~$ ./fix
Error! no time given.
user@bionic:~$ ./fix 2
doing something ...
I slept for ... 2
Goodbye.
HTH
#!/bin/bash
#
# Use of timeout to kill program after specified time
if [ $# -eq 0 ]; then
echo "Error! no time given."
echo "Syntax:"
echo
echo "15s = 15 seconds"
echo "1m = 1 minute"
echo "1h = 1 hr"
exit 1
fi
timeout $1 seamonkey
I used the & to put the process in the background, then kill it.
I used gnome-calculator since I dont have seamonkey. When I type
./fix 5 calculator pops up, then 5 seconds later it closes.
#!/bin/bash
seems my email got chopped. Here’s the script again …
#!/bin/bash
#
if [ $# -eq 0 ]; then
echo "Error! no time given."
exit 1
fi
echo "doing something ..."
gnome-calculator &
sleep $1
echo "I slept ..." $1
killall gnome-calculator
echo "Goodbye."