[Solved] Scripts don't run
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
[Solved] Scripts don't run
I must have something seriously wrong with my system.
Among other things, NONE of the scripts on this topic work for me. viewtopic.php?f=213&t=77483
I've copied/pasted, set the exec bit, as instructed here and elsewhere. viewtopic.php?f=47&t=266311&p=1448150#p1448150
Absolutely nothing happens. More strange stuff here: viewtopic.php?f=157&t=266144&p=1448172#p1448172
I'm tired of having to re-install when stuff doesn't work and I can't get it fixed with help from multiple sources. Needing some encouragement here lest I just dump Mint and try Fedora or something....
Among other things, NONE of the scripts on this topic work for me. viewtopic.php?f=213&t=77483
I've copied/pasted, set the exec bit, as instructed here and elsewhere. viewtopic.php?f=47&t=266311&p=1448150#p1448150
Absolutely nothing happens. More strange stuff here: viewtopic.php?f=157&t=266144&p=1448172#p1448172
I'm tired of having to re-install when stuff doesn't work and I can't get it fixed with help from multiple sources. Needing some encouragement here lest I just dump Mint and try Fedora or something....
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Scripts don't run
Did you chmod it executable
If you're in a folder that's not in the PATH then precede the script with ./ as in ./script
If you're in a folder that's not in the PATH then precede the script with ./ as in ./script
Re: Scripts don't run
Yes, I've done that.
I've done everything suggested.
Frustration is maxing out.
(An alternative to system problems is user problems, of course, but I don't really want to end up there.)
I've done everything suggested.
Frustration is maxing out.
(An alternative to system problems is user problems, of course, but I don't really want to end up there.)
Re: Scripts don't run
Code: Select all
@MainBox ~ $ ls -lh Script-Starter.sh
-rwxrwxrwx 1 devlin devlin 474 Mar 24 13:51 Script-Starter.sh
Re: Scripts don't run
Exactly - did you tryPat D wrote: ⤴Sat Mar 24, 2018 3:05 pmIs that what you wanted?Code: Select all
@MainBox ~ $ ls -lh Script-Starter.sh -rwxrwxrwx 1 devlin devlin 474 Mar 24 13:51 Script-Starter.sh
./Script-Starter.sh
in the terminal What does
cat ~/Script-Starter.sh
return Re: Scripts don't run
How about also
Code: Select all
cat Script-Starter.sh
sh Script-Starter.sh
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Your data and OS are backed up....right?
Re: Scripts don't run
Here you go - the script was copied and pasted from the bash sticky:
Code: Select all
devlin@MainBox ~ $ cat Script-Starter.sh
#!/bin/bash
# Purpose: Inserts #!/bin/bash into a file and makes it executable
# Usage: scriptname /path/to/file.sh
# Author: JJ/Habitual
# Date: Tue Jul 19, 2011
# Version: 1311133977
# Disclaimer: Use it, abuse it, just don't lose it.
MINPARAMS=1
if [ -n "$1" ]
then
echo "#!/bin/bash" > $1
chmod 700 "$1"
echo File $1 is now an executable and ready to be edited.
fi
if [ $# -lt "$MINPARAMS" ]
then
echo Usage: `pwd`/`basename $0` /path/to/script.sh
fi
exit 0
devlin@MainBox ~ $ sh Script-Starter.sh
Usage: /home/devlin/Script-Starter.sh /path/to/script.sh
devlin@MainBox ~ $
Re: Scripts don't run
Enter
Then paste back
./Script-Starter.sh test_script
Then paste back
cat test_script
Re: Scripts don't run
Code: Select all
devlin@MainBox ~ $ ./Script-Starter.sh test_script
File test_script is now an executable and ready to be edited.
devlin@MainBox ~ $ cat test_script
#!/bin/bash
devlin@MainBox ~ $
But I had just reverted the kernel back to 4.4 as per Pjotr in viewtopic.php?p=1448266#p1448266
Re: Scripts don't run
If you look at your output
It ran because it gave the message from this segment of the script
Code: Select all
devlin@MainBox ~ $ sh Script-Starter.sh
Usage: /home/devlin/Script-Starter.sh /path/to/script.sh
devlin@MainBox ~ $
Code: Select all
if [ $# -lt "$MINPARAMS" ]
then
echo Usage: `pwd`/`basename $0` /path/to/script.sh
fi
exit 0
Re: Scripts don't run
OP, the script did the right thing the 2nd time because you passed it the parameter it wanted.
That "if [ $# -lt "$MINPARAMS" ]" in the script said "if number of passed params less than 1" then give the error.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Your data and OS are backed up....right?
Re: Scripts don't run
OK.
I changed the kernel tp 4.4.0-116 as Pjotr said, and now all the scripts I was trying to learn with are working. Thanking you loads, sir.
Flemur, WharfRat, with you're explanations I might be starting to get a handle on bash scripting.
(It's hard to learn to do things when your system seems to conspiring to mess things up, lol)
I changed the kernel tp 4.4.0-116 as Pjotr said, and now all the scripts I was trying to learn with are working. Thanking you loads, sir.
Flemur, WharfRat, with you're explanations I might be starting to get a handle on bash scripting.
(It's hard to learn to do things when your system seems to conspiring to mess things up, lol)