brokenman wrote:Keen eye sean.
He does have that, for sure.
I think this is the same problem you had with a previous script. Don't forget to rerun your script with arguments.
su -c "sh $0"
Try: su -c "sh $0 $1"
A great thought, and excellent suggestion. Thank you
brokenman, that worked.
I'd been trying to use the approach you used in the save-session (lines 26-35) script, but was not getting that quite right. My variable was getting assigned the file's name rather than it's contents. What was I doing wrong?
Code: Select all
#!/bin/bash
if [ ! "$1" = "" ]; then
echo $1 > /tmp/pe.tmp
fi
if [ `whoami` != "root" ]; then
su -c "sh $0 $1"
exit
fi
echo PRESS_ENTER=$PRESS_ENTER
PRESS_ENTER=""
if [ -a /tmp/.pe.tmp ]; then
PRESS_ENTER="</tmp/pe.tmp"
rm /tmp/pe.tmp
fi
echo PRESS_ENTER=$PRESS_ENTER
if [ "$PRESS_ENTER" = "" ]; then
echo -en "Enter Y to continue. "
read
fi
exit
Code: Select all
guest@porteus:~$ test.sh y
Password:
PRESS_ENTER=
PRESS_ENTER=</tmp/pe.tmp
guest@porteus:~$
sean wrote:Mind if I ask what it is you are trying to accomplish with this?
Not at all. The code you see is a test piece for another script that I want to modify to run as a desktop app. This other script does two functions which I manually control when I run it from terminal mode. When I run it from a desktop icon I want it to do both functions without my manual input.