Ubuntu System Write shell script program installs multiple packages at once
Writing shell scripts installs multiple software at once, primarily for some software-dependent environment configurations.
1. The shell script must start with the following line (must be in the first line of the file):
#!/bin/sh
The symbol #! is used to tell the system that the parameter behind it is the program used to execute the file. In this example we use/BIN/SH to execute the program.
2. After editing the script, you must also make it executable.
To make the script executable:
chmod +x filename
3. You can then execute your script by entering:./filename.
As follows:
Here are the multiple packages that NS3 relies on before I install NS3:
1. Edit the following file in VI
#!/bin/sh
sudo apt-get install gcc g++ python-y
sudo apt-get install gcc g++ python python-dev-y
sudo apt-get install mercurial-y
sudo apt-get install bzr-y
sudo apt-get install gdb valgrind-y
sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl-y
sudo apt-get install Flex Bison libfl-dev-y
sudo apt-get install g++-3.4 gcc-3.4-y
sudo apt-get install tcpdump-y
sudo apt-get install aqlite aqlite3 libsqlite3-dev-y
sudo apt-get install libxml2 libxml2-dev-y
sudo apt-get install libgtk2.0-0 libgtk2.0-dev-y
sudo apt-get install Vtun lxc-y
sudo apt-get install uncrustify-y
sudo apt-get install Doxygen grphviz imagemagick-y
sudo apt-get install texlive texlive-extra-untils texlive-latex-extra-y
sudo apt-get install Python-sphinx dia-y
sudo apt-get install Python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev-y
sudo apt-get install Libboost-signals-dev libboost-filesystem-dev-y
sudo apt-get install openmpi*-y
: Wq mysetup # (note) saved as a file with Mysetup name
2. Compile in Terminal: chmod +x Mysetup
3, run the installation, the terminal input:./mysetup
Ubuntu System Write shell script program installs multiple packages at once