exit in script files cause konsole terminal itself to exit
I noticed that if I have "exit" in a bash script file., e.g.
script.sh, that when the word "exit" is reached, and the script file being executed is not in the PATH environment, i.e. ". script.sh", the whole konsole shell profile is exited! What gives here? Is there another command compatible to "exit" to prevent this, or will I just have the leave the "." part in the PATH enviroment, which is, to my understanding, is not recommended? I desire for a "goto" function in bash script files. :study: Thanks, Clifton |
It's because your sourcing. You should be starting it with:
./script.sh (no space between the . and the slash) |
Quote:
Clifton |
Quote:
If you try the alternate method and it doesn't work, please post the offending script (or, preferably, a minimal example that demonstrates the same behaviour). |
Quote:
Code:
/media/drawers/practice/awkgrepsed $ ./log_gets.sh Code:
#!/bin/bash Thanks, Clifton |
Fascinating... I moved the files to the ~/Documents/Practice directory, and
Code:
./log_gets.sh Code:
. log_gets.sh Clifton |
Quote:
Are you clear about the difference between ./log_gets.sh and . log_gets.sh? They are very different. |
The filesystem containing /media/drawers/practice/awkgrepsed may have been mounted with the noexec option, That would explain why you get permission denied even when it's marked executable and works when moved elsewhere.
|
Quote:
Quote:
Thanks. Clifton |
Quote:
Thanks, Clifton |
Quote:
|
Quote:
Clifton |
All times are GMT -5. The time now is 09:46 PM. |