Hi Any Forums, oldfag from 2016 here, do I have to end Bash scripts with exit 0 every time...

Hi Any Forums, oldfag from 2016 here, do I have to end Bash scripts with exit 0 every time? And what's the deal with symlinking scripts to the /bin directory?

Attached: 1134920653.jpg (1680x1668, 309.61K)

Other urls found in this thread:

tldp.org/LDP/abs/html/exitcodes.html
twitter.com/NSFWRedditGif

>oldfag from 2016
kys
>do I have to end Bash scripts with exit 0 every time?
no
>what's the deal with symlinking scripts to the /bin directory?
retardation

based 2016 veteran

exit is only useful if you want to exit the shell immediately or return a non-zero on exit

armpits

>what's the deal with symlinking scripts to the /bin directory?
isn't it because thats one of the default search paths for bash to look for scripts? so you can just time "nigger" to invoke the script instead of "./nigger" for example

I see, so simply closing the shell/terminal manually after executing the script would have the same effect
I'm not sure but that does make sense. I see people talk about doing it to avoid having to manually edit the scripts when they're moved to different locations

Attached: 33920443152.jpg (1304x1440, 216.56K)

That's my catwife Kyaru right there, buddy. You better show some respect or I'm gonna post more pictures of her

Attached: 2349452657.jpg (1124x1440, 218.83K)

>simply closing the shell
yes, but I was mostly talking about exiting subshells within your scripts, this seems to completely fly over your head though

A well written script shouldn't need any changes if moved around, the positional variable $0 tells you the name of the executable name for the script.

You could use this internally, or make a script automatically enable certain features if called with a different name, like nano does.
It comes with a symbolic link rnano which points to nano.

Relative symlinks ARE sensitive to where they are placed and would have to be edited if they're not using absolute paths.

Exit codes are for debugging, mainly.

See: tldp.org/LDP/abs/html/exitcodes.html

>I see people talk about doing it to avoid having to manually edit the scripts when they're moved to different locations

If the script is local, it's best to put it in /home/$USER/.local/bin, adhering to the XDG Base Directory Specification.

/usr/bin is where you should place global scripts. If you're editing a script often, you can use a symlink, keeping the link somewhere in your home folder and the target in /usr/bin.

Most shell configurations don't add $HOME/.local/bin to their $PATH, you have to add it to your ~/.profile yourself.

No
/bin should be on your path

2012 here and I'm not old. gtfo newshit

Alright, I'm not doing anything complex, just writing simple scripts to kill processes that hang after their parent process closes. Very basic stuff but there are multiple cases (for multiple programs as well) so having an executable do it automatically is faster. Was curious about the Exit 0 because I see it often.

THE ONLY THING I CARE ABOUT IN THIS WORLD IN BASKING IN THE SCENT OF THE FEMALE ARMPIT, YOU BITCH

I PAY PROSTITUTES TO GO ALL DAY WITHOUT DEODORANT. LITERALLY RIDING ON COCKS FOR HOURS, GETTING ALL SWEATY JUST SO I CAN PAY THEM PREMIUM TO HUFF AND LICK THEIR DELICATE SALTY PIT

DO NOT REPLY TO ME AGAIN WITH YOUR UNSOLICITED POST

I-I kneel

Your pain is greater than mine

Attached: 158853459.jpg (1600x1980, 313.36K)

>kill processes that hang after their parent process closes

If this is a regular issue, use trap cleanup 0 1 2 3 6 15

# where cleanup is a function to run on exit
# -- in most commands stops accepting flags and takes the rest of the arguments as literals
# $$ is the current process PID for the current shell instance
# kill takes negative PIDs to mean kill all child processes
# -$$ means kill this pid and everything below it
cleanup() { kill -- -$$ 2> /dev/null; }

>Exit codes are for debugging

Doesn't it work for displaying execution errors as well?

nakadashi karyl

Attached: 4e3eb1c83a9c6204fd1cdcff2206e831.jpg (420x420, 28.02K)

I'll leave hickeys on your armpits, bich

>oldfag

But you're phone posting...

NO

Attached: 1428660553459.jpg (1164x1324, 194.02K)