r/ProgrammerDadJokes • u/danielsoft1 • Jan 13 '20
How much does first parameter of a shell script cost?
$1
10
9
5
-5
u/joker54 Jan 13 '20 edited Jun 29 '23
Unfortunately, I have removed all content I provided, as I refuse to give free labor to a company that doesn't respect us.
So long, and thanks for all the fish
3
u/nahidtislam Jan 14 '20
nah
$0is the path to the app/script1
u/joker54 Jan 14 '20 edited Jun 29 '23
Unfortunately, I have removed all content I provided, as I refuse to give free labor to a company that doesn't respect us.
So long, and thanks for all the fish
1
u/nahidtislam Jan 14 '20
I usually use $0 parameter to get the name of itself. on like the 3rd line (two lines below
#!/bin/bash) I type inSELF_SCRIPT_NAME="$(( basename $0 ))so I can use it to print error or informational messages to the user1
0
Jan 13 '20
[deleted]
17
u/danielsoft1 Jan 13 '20
This is not Swift. This is about Unix/Linux shell: https://en.wikipedia.org/wiki/Bash_(Unix_shell)
0
Jan 13 '20
[deleted]
8
u/Kwdg Jan 13 '20
But even there $0 is the first 'item' (the name of the program) and $1 is the first parameter given to the program
8
60
u/TheEpsilonToMyDelta Jan 13 '20
Saw that one coming
Upvpte anyway