
I have 2 scripts. one a clone of the other. In them I have this piece of code:
Code: Select all
if [ `whoami` != "root" ]; then
redpswd "Enter root's password"
su -c "sh $0 $1"
exit
fi
echo $rst
When I run one script I get:
Code: Select all
guest@porteus:~$ savedatremoveafile.sh
Enter root's password
Password:
Enter name of file to remove.
Code: Select all
guest@porteus:~$ savedatspaceused.sh
./savedatspaceused.sh: line 22: unexpected EOF while looking for matching ``'
./savedatspaceused.sh: line 84: syntax error: unexpected end of file
guest@porteus:~$
Now some will think the problem is due to lines before line 22, so here are lines 1-22 of the script with the error:
Code: Select all
#!/bin/sh
# http://forum.porteus.org/viewtopic.php?f=81&t=1941&start=15#p13272
# http://forum.porteus.org/viewtopic.php?f=117&t=3205&p=25099#p25097
# mloop requires changes= cheatcodes not used (Always Fresh mode)
BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}
GUEST="$BOOTDEV/$FOLDER/Guest"
MODULES="$BOOTDEV/$FOLDER/Modules"`
# Color definitions
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Red
rst=$(tput sgr0) # Reset
function redpswd() {
echo -e "$1" $txtred
}
if [ `whoami` != "root" ]; then
redpswd "Enter root's password"
su -c "sh $0 $1"
exit
fi
echo $rst
Code: Select all
#!/bin/sh
# http://forum.porteus.org/viewtopic.php?f=81&t=3501&p=25182#p25178
# http://forum.porteus.org/viewtopic.php?f=81&t=3501&p=25151#p25162
# http://forum.porteus.org/viewtopic.php?f=81&t=3501&p=25151#p25178
# mloop requires changes= cheatcodes not be used (Always Fresh mode)
BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}
GUEST="$BOOTDEV/$FOLDER/Guest"
MODULES="$BOOTDEV/$FOLDER/Modules"
# Color definitions
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Red
rst=$(tput sgr0) # Reset
function redpswd() {
echo -e "$1" $txtred
}
if [ `whoami` != "root" ]; then
redpswd "Enter root's password"
su -c "sh $0 $1"
exit
fi
echo $rst
And for the concern as to the working script's name, it is only used to fix deleted files whose name contains a blank.
The script with the error has worked in the past and I was surprised to encounter the error today, which adds to my confusion.