one Flashcards
Starting off with a Sha-Bang
#! tells the script to be fed to a specific interpreter
If the sha-bang is incorrect
Probably I will get “Command not found”
what will #!/bin/sh invoke
It will invoke the default shell interpreter, namely, bash
How to interpret a file manually using bash?
bash filename
Find out the current shell name
cat /etc/shells
echo $SHELL
ps $$
ps -p $$
How to get manuals of commands
man command
command –help
How to find out a command is a built-in or an external binary file
type -a
bash startup scripts
script of commands executed at login to set up environment
login shell
when login shell is started: 1 /etc/profile runs first 2 /etc/profile.d 3 $HOME/.bash_profile which will cass $HOME/.bashrc $HOME/.bash_login $HOME/.profile
logout shell
If log out, it will call $HOME/.bash_logout
find out available binary packages shell list
yum search shell
apt-cache search shell
Display the full path of shell commands
which command
multiple line comment
remove permission
chmod ugo= filename
debug bash script
bash -x scriptname