Open utterances-bot opened 4 years ago
Into What Directory should user Bash Scripts - either tutorial or purposeful - GO? Single, Multiple, whatever? Thank you for this concise, specific and stunningly simple tutorial which I will unpack and digest over the coming days.
Hi @wogelsby, it doesn't really matter where the scripts are located, as long as you follow the instructions for setting the proper permissions on them. Some tutorials will tell you to make a bin
directory and put that in your path, but it's not necessary.
Well written article! 😎
Elegant set I’ll recommend it for every bash newcomer. ;)
@wogelsby that may depend on used OS and/or used additional package manager(s) in it.
Fastest check in your terminal $PATH
like:
cat /etc/paths
and/or
echo $PATH
/usr/local/bin
or
/usr/local/sbin
On the other hand for learning, teaching and private-usage purposes I also suggest creating bin
and sbin
folders in your $HOME
like:
mkdir $HOME/bin
mkdir $HOME/sbin
in your $HOME/.profile
(or $HOME/.bash_profile
, depending on OS) export these paths like:
export PATH=$HOME/bin:$HOME/sbin:$PATH
back to the terminal, open a new window to include new exports, or source
them in the current window like:
source $HOME/.profile
# or
# source $HOME/.bash_profile
check if your exports are included:
echo $PATH
You should see your new exported paths among others like /Users/you/bin:/Users/you/sbin:<other>
Then all scripts placed in $HOME/bin
or $HOME/sbin
will be available, just to remember to chmod +x
after touching ;)
I deliberately use $HOME
instead of ~
in this description, although personally I prefer the last one, the first is probably safer depending on OS.
Valuable info, biesior... appreciate it.
Thank you. Best explanation for user begginers that I found!
“You can drink!” Lol I think I actually wrote something like that once
Nice work here. Thanks for the help!
Wow! I just had to stop by and add a comment because this is as simple and clear as it can get. Very nice article. Thanks a lot. Everything is super clear and the article is not too long or short and has a nice flow.
A clear, concise, and helpful tutorial. Thanks for writing.
Very great article Tiana. I am newbie to bash scripting. sometimes i get confused with some flags. for instance if [-z ls 4]. what's the meaning of -z?
hello, read a lot about bash, but still, no article like yours. so clean!!! loved the dark mode and indigo marks. this is really good progammer stuf!!!! have a nice day :)
I was so stressed about my assignment but you just removed all my fear and anxiety about bash, thank you for this amazing article! 10/10
Hey Tania, I think there's a typo on the output of this command:
echo -e "This string has a \new line"
It should be:
This string has a
ew line
How to Create and Use Bash Scripts | Tania Rascia
Bash scripting is an extremely useful and powerful part of system administration and development. It might seem extremely scary the first…
Thanks for this very well presented information.
Simply amazing.. for a beginner!
How to Create and Use Bash Scripts | Tania Rascia
Bash scripting is an extremely useful and powerful part of system administration and development. It might seem extremely scary the first…
https://tania.dev/how-to-create-and-use-bash-scripts/