Linux programming-11. ShellScript (bash) -- (2) tutorial
Source: Internet
Author: User
Article title: Linux programming-11. ShellScript (bash) -- (2) Tutorial example. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
"Hello world" Shell Script
According to the traditional program teaching example, this section describes how to write "Hello World" of Shell Script.
Everyone should notice the first line "#! /Bin/sh ". In UNIX, all executable scripts start "#! ", For example, Perl is "#! /Usr/bin/perl ", tcl/tk is "#! /Usr/bin/wish ", check where the Script program you want to run is located. You can also use "#! /Bin/bash ","#! /Bin/tcsh "and so on to specify a specific Shell.
Echo is a built-in bash command.
Type 2: Use the bash built-in command "source" or ".".
[Foxman @ foxman bash] # source hello
Hello world
Or
[Foxman @ foxman bash] #. hello
Hello world
-C string: read string as a command.
-I: interactive interface.
-S: Read command by stdin.
-: Cancel reading to the backend option.
-Norc: Do not read ~ /. Bashrc.
-Noprofile: Do not read/etc/profile ,~ /. Bash_profile ,~ /. Bash_login ,~ /. Profile and so on.
-Rcfile filename: execute filename instead ~ /. Bashrc
-Version: displays the version.
-Quiet: do not roll it up at startup.
-Login: make sure bash is a login shell.
-Nobraceexpansion: Do not use the curly brace expansion ({}) symbol ).
-Nolineediting: Read command columns without readline.
-Posix: Posix 1003.2 standard.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.