The full ln command reference: http://www.runoob.com/linux/linux-comm-ln.html
LN: Creating a Connection File
-The default is to create a hard connection, like copy, but two files are synchronized
Command: Ln./java/android/aa.txt AAA
-S: Create a soft connection to point to (similar to Windows shortcut)
Soft Links: 1 . Soft links exist in the form of paths. Similar to shortcuts in Windows operating systems 2. Soft links can cross file systems, hard links can not be 3. Soft links can link to a nonexistent file name 4 Soft links can link hard links to a directory: 1 . Hard links exist as copies of files. But does not occupy the actual space. 2 not allowed to create hard links to directories 3. Hard links can only be created in the same file system
For example:
Executable file: qq.sh
num=3#!/bin/Bash Case$numinch1) echo"Num=1";;2) echo"num=2";;3) echo"num=3";;4) echo"num=4";;*) echo"Defaul";; Esac
To give operational permissions:
chmod +x qq.sh
1. Create a directory WW and create a hard connection to run the file qq.sh in the WW directory and run:
[Email protected] ~~]# CD ww[[email protected] ww]# ls[[email protected] ww]# Ln. /qq.sh qq[[email protected] ww]# Lsqq[[email protected] ww]#. /Qqnum=3
2. Create a soft connection and run
Create soft Connect ln -S. /qq.sh Qq.sh.link
./Qq.sh.link
[[Email protected] ~~]# CD ww[[email protected] ww]# ls[[email protected] ww]# ln -S. /qq.sh -018: Qq.sh.link. /Qq.sh[[email protected] ww]#. /Qq.sh.linknum=3[[email protected] ww]#
3. The above qq.sh can be modified to extract the input parameters:
The bash shell can get parameters based on the parameter location. Command -line arguments for 1th through 9th are obtained through $9 . The shell name is $ A. If the parameter is more than 9, then it can only be obtained through ${} , for example, to get the 10th parameter, then write as ${10}.
Reference: http://www.cnblogs.com/qlqwjy/p/7746009.html
num=$1#!/bin/Bash Case$numinch1) echo"Num=1";;2) echo"num=2";;3) echo"num=3";;4) echo"num=4";;*) echo"Defaul";; Esac
Run the original qq.sh
[[email protected] ww]#/qq.sh 4num=4
Running a soft connection
[[email protected] ww]#. /qq.sh.link 2num=2
------------------------------------------Linux is set up to boot-------------------------with LN and chkconfig
The first step: we create a new file under/ETC/INIT.D test (need to operate under root privileges)
[[email protected] ww]# vim/etc/init.d/test
Copy the above qq.sh content:
num=$1#!/bin/Bash Case$numinch1) echo"Num=1";;2) echo"num=2";;3) echo"num=3";;4) echo"num=4";;*) echo"Defaul";; Esac
Step two: After you save the exit, add executable permissions to it
[email protected] ww]# chmod +x /etc/init.d/test
Step Three: Mount (create a soft connection)
Connect the shell file link to the/etc/rc2.d/directory. The numbers in the/etc/rcx.d/directory for Linux represent different run level when booting up, that is, the order of start-up, there are 0-5 six level under Ubuntu9.10, and can not be attached to other directories, and may be required by Tomcat when the program in that directory starts. Some of the libraries you want have not yet been loaded, using the LN command to link the links of Tomcat to the past: sudo ln-s/etc/init.d/tomcat/etc/rc2.d/s16tomcat. The naming rules under the RCX.D directory are very specific, more different needs may be the beginning of s, may also be the beginning of K, after the numbers represent their starting order, detailed look at the Readme file in their respective directories.
[[email protected] ww]
Fourth step: Set the script to boot from
Set this script to automatically execute when the system starts, and stop automatically when the system shuts down, using the following command:
[[email protected] ww]# chkconfig--add Test
Linux writes operational shell scripts and creates ln connections in other directories and sets boot up