sometimes you will write shell in windows platform, be careful for this, adjust the notepad plus plus information.
/etc/profile
A global configuration script that applies to all users.
~/.bash_profile
A user's personal startup file. Can be used to extend or override settings in the global configuration script.
~/.bashrc
A user's personal startup file. Can be used to extend or override settings in the global configuration script.
command << token
content to be used as command's standard input token
command >>file.txt command >file.txt ,pipe redirect the content to file.
>> append to the file >overwrite the file
Assigning A Command's Result To A Variable
You can also assign the results of a command to a variable:
right_now=$(date +"%x %r %Z")
Constants
IFS=$’\n’
Exit Status
Commands (including the scripts and shell functions we write) issue a value to the system when they terminate, called an exit status. This value, which is an integer in the range of 0 to 255, indicates the success or failure of the command’s execution. By convention, a value of zero indicates success and any other value indicates failure.
Expression
d file
True if file is a directory.
-e file
True if file exists.
-f file
True if file exists and is a regular file.
exit
In order to be good script writers, we must set the exit status when our scripts finish.
exit 0
exit 1
Positional parameters are a series of special variables ($0 through $9) that contain the contents of the command line.