HowTo: Run the .sh File Shell Script In Linux / UNIX
2014-04-15 11:36
681 查看
原文转载至:http://www.cyberciti.biz/faq/run-execute-sh-shell-script/
HowTo: Run the .sh File Shell Script In Linux / UNIX
by Nix Craft onSeptember 26, 2007 · 41 comments·
LAST UPDATED September 13, 2010
in BASH Shell,
CentOS,
Debian / Ubuntu
I've downloaded a software for Linux from the Internet. There is a file called install.sh. How do I run an .sh file to install the software?
.sh file is nothing but the shell script to install given application or to perform other tasks under UNIX like operating systems. The easiest way to run .sh shell script in Linux or UNIX is to type the following commands. Open the terminal (your shell prompt)
and type the command:
sh file.sh
OR
bash file.sh
.sh File As Root User
Sometime you need to install application which requires root level privalageSome time you need root access to install application; without root, you won't have the necessary permissions to install application or make system level modifications. Root access is disabled by default on many Linux and UNIX like systems. Simply use sudo
or su as follows:
sudo bash filename.sh
Type your password. Another option is to use the su command as follows to become superuser:
su -
Type root user password and finally run your script:
bash filename.sh
chmod Command: Run Shell Script In Linux
Another recommend option is to set an executable permission using the chmod command as follows:chmod +x file.sh
Now your can run your .sh file as follows
./file.sh
相关文章推荐
- Bash/KSH/SH Shell: Find The Length Of a String On a UNIX, Linux, BSD, and OS X
- how to run 2 or more commands in a shell script [for Linux & Windows]
- run commands in linux shell using batch file
- Forward: HowTo: Open a Tar.gz File In Linux / Unix
- 4 Ways of Executing a Shell Script in UNIX / Linux
- linux_Problem when trying to run shell script : No such file or directory
- There are inconsistent line endings in the 'Assets/Scripts/Test.cs' script. Some are Mac OS X (UNIX)
- The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods install
- IOS 从网上下载的项目,运行时出现“The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update y”
- "The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods i"解决方法
- npp-installer - A script to install the popular Win32 editor Notepad ++ in Linux - Google Project Hosting
- XXX is not in the sudoers file 解决方案:赋予linux普通用户挂载光驱的权限
- sockfs: the most simple file system in linux kernel
- linux下遇到xxx is not in the sudoers file
- Linux教程:XXX is not in the sudoers file解决
- Ex2010-19 How to Run the Exchange Management Shell EMS in PowerShell
- About file permission in Unix/Linux
- 【Linux学习】Linux报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法
- Linux Sudo xxx is not in the sudoers file 的解决方法
- Linux下is not in the sudoers file(转)