亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? shell-scripting.html

?? Linus guide, Linus guide, Linus guide,
?? HTML
字號(hào):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><TITLE>Shell Scripts Made Easy</TITLE>	<META NAME="Description" CONTENT="A brief summary of bash shell scripting.">	<META NAME="Author" CONTENT="Paul Winkler"></HEAD><LINK REL="stylesheet" TYPE="text/css" HREF="default.css"><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#7F007F"><H2>Shell Scripting Made Easy</H2><FONT SIZE="-1"><B>Created: December 21, 1999</B></FONT><BR><FONT SIZE="-1"><B>Last updated: December 21, 1999</B></FONT><BR><FONT SIZE="-1"><B>Development stage: Alpha</B></FONT><BR><P>You may have heard that one advantage of Linux is that everythingis programmable. You can automate just about any task. There are a lotof ways of doing this. One of the most common is the <b>shellscript</b>, which is sort of equivalent to a DOS "batch file".</P><p>Simply put, a shell script is a list of commands to run; but it's alot more flexible than that implies.</P><p>If you get into really complicated scripting, especiallyautomatically processing text files, you may be better offlearning a scripting language like python or perl or scheme or tclor...</P><h3>DISCLAIMER</h3>Several things to watch out for:<ol><p><li>The example scripts assume you are running a bourne-compatibleshell, specifically bash. They will not work with tcsh or othershells.  <p><li>The example scripts come with <b>no warrantywhatsoever.</b> I will not be held responsible if any of them eat yourfiles, trash your hard drive, etc. I use all these scripts myself, butI make no guarantees.</ol><H3>Index</H3><OL><LI><A HREF="#Overview">Overview</A> - how to start writing bashshellscripts</LI><li><a href="#Basics">Basic Techniques</a>	<UL>	<li><a href="#comments">Comments</a> - built-in documentation	<li><a href="#variables">Variables</a> - how to re-use information	<li><a href="#arguments">arguments</a> - using stuff from the	command line	<li><a href="#backquotes">backquotes</a> - getting command output	<LI><A HREF="#if">if...then</A> - conditional actions</LI>	<LI><A HREF="#for">for...do</A> - repeating actions</LI>	</UL><li><a href="#Examples">Examples</a> - a bunch of my favoritescripts.<LI><A HREF="#books">Related Books</A> - books to consider forfurther information</LI></OL><A NAME="Overview"></A><H3>Overview</H3>To make a shell script, do this:<ol><li>Create a file, let's call it "foo". Put it in a directory in yourpath. I recommend creating a directory called 'sh' in your homedirectory as a special place to put your own shell scripts. Add thisdirectory to your path by putting this command in /etc/profile, or in.bash_profile in your home directory: <tt>exportPATH=$PATH:/home/my-user-name/sh</tt><p><li>In the first line of the file, type this: <tt>#!/bin/sh</tt><p>That's a magic word that tells the system you want to execute thecommands in this file using the 'sh' shell, which on most linuxsystems is actually a <ahref="http://jgo.local.net/LinuxGuide/linux-commands.html#ln">link</a>to /bin/bash.<p><li>Change the permissions on the file, by giving this command:<p><tt>chmod +x foo</tt><p>This makes the file "executable"; now you can execute it just bytyping its name. For more information see <ahref="http://jgo.local.net/LinuxGuide/linux-chmod.html">usingchmod</a>.<p><li>Now put some commands in the file!</ol>As an example, let's take this really simple script:<pre>#!/bin/shecho hello world</pre><p>Make the file executable, then type the file's name as acommand. Guess what... it prints 'hello world.'<a name="Basics"><h3>Basic Techniques</h3></a><a name="comments"><h4>Comments</h4></a><blockquote>You can put comments in your scripts, by typing the '#'character. Anything after the # will be ignored. Use this feature; itwill help you remember what your script is supposed to do later, andit can help anyone else who uses your script.</blockquote><a name="variables"><h4>Variables</h4></a><blockquote>It can confuse you at first, but there's basically only twosyntax rules to remember about variables in the bash shell:<ol><li>to make use of thevariable, put a dollar sign in front of the name;<li>To create the variable, use an equal sign immediately after thevariable name (no spaces!), and DON'T use the dollar sign before thename.</ol> <p>Example: Let's create and then print a variable. Try typing this at the shell prompt:<p>foo='hello' ; echo $foo</blockquote><a name="arguments"><h4>Arguments</h4></a><blockquote>When you run a shell script, you can give arguments. The arguments arestored in variables called $0, $1, $2, $3, ...<p>The first one, $0, actually gives you the name of the shell scriptitself. The rest starting with $1 are the ones you're more likely touse right away. To play with this idea, try this script:<pre>#!/bin/shecho $1echo $2echo $3</pre></blockquote><a name="backquotes"><h4>Backquotes</h4></a>You can get the output of any command just by putting it in backquotes(the backquote key is usually in the upper left of the keyboard).<p>Example: Type this at the command line: <tt>listing=`ls`</tt><p>Now the variable <tt>$listing</tt> contains the output of thecommand <b>ls</b>, namely, a list of files.<a name="if"><h4>if...then</h4></a><blockquote>What if you want your script to do different things under differentcircumstances? Easy, just use an 'if' block, like this:<pre>if some-test-commandthen     do-somethingfi</pre>Just replace <i>some-test-command</i> with a command that eithersucceeds ("returns true") or fails ("returns false"). And replace<i>do-something</i> with a command you actually want to run if thetest command returns true!<p>Notice that you always have to use 'fi' to close the block. ('fi'is 'if' backwards, get it? Ahh, unix humor, ha ha.)<p>You can also add an <b>else</b> clause, which tells what to do ifthe test command is false, like this:<pre>if some-test-commandthen     do-somethingelse     do-something-elsefi</pre><p>You can also add an <b>elif</b> clause, which is shorthand for"else if", meaning, "on the other hand, if something else istrue...". This lets you test for more than one condition.<pre>if some-test-commandthen     do-somethingelif some-other-test-commandthen     do-something-elseelse     do-something-entirely-differentfi</pre>Hopefully this will all become clear in the <ahref="#Examples">Examples</a> below.</blockquote><h4><a name="for">for...do</a></h4><blockquote><b>for</b> provides a way to do the same action a bunch of times witha bunch of different things. For example, say you have a list of filesstored in a variable, and you want to copy all those files. You coulddo that like this:<pre>files="foo bar baz batz"for f in $filesdo     cp $f $f.backupdone</pre>Or you could do that all on one line, like this:<tt>for f in $files; do cp $f $f.backup ; done</tt></blockquote><hr><a name="Examples"><h3>Examples</h3></a>These are not guaranteed to be great examples, but they should beunderstandable, and I use them all.<p>For some really great useful shell scripts, see the <ahref="http://www.linuxdoc.org/HOWTO/Tips-HOWTO.html">LinuxTips-HOWTO</a>, which you may have in /usr/doc/HOWTO/Tips-HOWTO.<hr><h4>Backing Up Configuration Files</h4><pre>#!/bin/sh# if [ ! $1 ]  # This means, "if there's no first argument..."then    echo "  "Usage: `basename $0` output.tar.gz    # note that `basename $0` gives the name of this script!    echo "    This creates a tarred, gzipped archive of all"    echo "    the hidden files in your home directory."    echo "    Warning: if an archive by that name exists,"    echo "    it will be overwritten."    exit 1 # Quit this script now!ficd ~ # go home!rm -f /tmp/skip# Make a list of files to skip... add to this as you wish.ls -1d --color=no .gimp/gimpswap* .gimp/tmp >>/tmp/skipls -1d --color=no .[a-zA-Z]*~ ~/.[a-zA-Z]*bak .[a-zA-Z]*errors>>/tmp/skipls -1d --color=no .[a-zA-Z0-9_]*/*cache .[a-zA-Z0-9_]*/*tmp >>/tmp/skipls -1d --color=no .[a-zA-Z0-9_]*/*~ >> /tmp/skipls -1d --color=no .[a-zA-Z]*/*.bak  >>/tmp/skipls -1d --color=no .[a-zA-Z]*/*.BAK  >>/tmp/skipls -1d --color=no .[a-zA-Z]*/*.backup  >>/tmp/skipls -1d --color=no .[a-zA-Z]*/*.old .[a-zA-Z]*/*.OLD  >>/tmp/skipecho "core" >> /tmp/skip# Make the archive, and put it in $OLDPWD, which is the directory we# were in before that cd command above.tar -cvz -X /tmp/skip -f $OLDPWD/$1  `ls -1 -d --color=no.[a-zA-Z]*`# Now clean up and go back where we wererm -f /tmp/skipcd $OLDPWD # go back to where we were before starting the script.</pre><hr><h4>Simple Trash Can</h4><pre>#!/bin/bash# Simple script to throw stuff in a "trash bin" instead of deletingit.# Requires a directory called "trash" in your home directory.# NOTE: Does not work on filenames with embedded spaces.if [ ! $1 ] ; then	echo Usage:	echo `basename $0` string	echo For filenames that contain \"string,\"	echo throws all files \(and their contents, if they aredirectories\)	echo into a \"trash\" directory in your home directory.	echo Options:	echo "-u  Disk usage of your trash directory."	echo "-ls  List files in trash."	echo "-empty  Delete everything in trash."	exit 1elif [ $1 = "-u" ] 2> /dev/null ; then	echo Disk usage of ~/trash:	du ~/trashelif [ $1 = "-empty" ] 2> /dev/null ; then	echo Emptying trash...	rm ~/trash/* ; rm ~/trash/.* 2> /dev/nullelif [ $1 = "-ls" ] 2> /dev/null ; then	ls -a ~/trash	else	for file in *$1* ; do	mv $file ~/trash	donefi</pre><hr><h4>Removing Spaces from Filenames</h4><pre>#!/bin/bash# Paul Winkler's second script, for removing spaces from files# that have stupidly been named with them, and substituting# the usual character "_" ...# 'case' is another way of testing things. Basically, the next 3lines# translate as: "if $1 is '-a' do everything up to the line ';;' ".case $1in  -a)   # If $1 is "-a"...   for files in *\ * ; do   echo mv \"$files\" `echo $files | sed s/\ /_/g` | bash   done   echo You just removed spaces in all filenames in `pwd`.   echo They have been replaced with \"_\".   ;;  -s)   # If $1 is "-s"...   for files in *$2* ; do   echo mv \"$files\" `echo $files | sed s/\ /_/` | bash   done   echo You just removed spaces in all filenames containing   echo \"$2\". They have been replaced with \"_\".   ;;  *)   # If $1 is anything else, print instructions!   echo Usage: \"`basename $0` -a\" to remove spaces from all filesin this directory \(`pwd`\).   echo \"`basename $0` -s anything\" to remove spaces from filescontaining   echo the string \"anything.\"   echo 'Spaces will be replaced with an underscore ("_").'esac # End of the "case" block.</pre><hr><hr><A NAME="books"></A><H3>Related Books</H3><OL><LI>Linux in a Nutshell - a good overview of all the most commonLinuxcommands, including a comprehensive section on the bash shell.</ol><HR><P><B><FONT SIZE="-1">Copyright &copy; 1999 <AHREF="mailto:slinkp@angelfire.com">Paul Winkler</A>. Allrights reserved. Permission to use, distribute, and copy thisdocument ishereby granted. You may modify this document as long as credit to meisgiven.</FONT></B></P></BODY></HTML>

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆精品国产91久久久| 亚洲国产成人av网| 欧美大片在线观看一区| 欧美日韩色一区| 欧美午夜精品久久久| 色女孩综合影院| 欧美在线影院一区二区| 在线中文字幕不卡| 色婷婷一区二区| 欧美日韩一区小说| 欧美一区二区福利在线| 欧美一级日韩免费不卡| 久久亚洲一区二区三区四区| 久久久久久久久久看片| 亚洲国产成人在线| 亚洲乱码中文字幕综合| 亚洲综合激情小说| 亚洲日本欧美天堂| 美女诱惑一区二区| 国产在线观看一区二区| 粉嫩aⅴ一区二区三区四区五区| 99精品视频一区二区三区| 91在线视频播放| 欧美午夜精品理论片a级按摩| 色婷婷久久久亚洲一区二区三区| 欧美精品1区2区3区| 精品少妇一区二区| 综合精品久久久| 麻豆极品一区二区三区| 青青草成人在线观看| 久久精品国产亚洲5555| 99久久99久久精品免费看蜜桃| 777xxx欧美| 最新中文字幕一区二区三区| 男女男精品网站| av爱爱亚洲一区| 欧美成va人片在线观看| 1区2区3区国产精品| 久热成人在线视频| 色综合中文字幕国产 | 蜜桃视频一区二区| jiyouzz国产精品久久| 欧美日韩成人激情| 国产精品久久久久久妇女6080| 日韩高清国产一区在线| 一本大道久久a久久综合婷婷| 欧美成人aa大片| 天天操天天色综合| 99热在这里有精品免费| 国产日产欧产精品推荐色| 日韩制服丝袜先锋影音| 91在线观看美女| 国产亚洲人成网站| 久久99深爱久久99精品| 欧美日韩视频在线观看一区二区三区 | 欧美电影精品一区二区| 亚洲男同性视频| 国产精品一区在线| 久久久另类综合| 日韩国产欧美一区二区三区| 日本精品一级二级| 中文字幕亚洲在| 美女视频网站久久| 欧美日韩一区高清| 亚洲国产aⅴ天堂久久| 91在线视频网址| 亚洲色图视频免费播放| 菠萝蜜视频在线观看一区| 欧美激情综合在线| 成人av网站免费观看| 国产嫩草影院久久久久| 成人一区二区三区在线观看| 26uuu国产电影一区二区| 麻豆精品新av中文字幕| 精品美女被调教视频大全网站| 蜜桃视频一区二区三区 | av亚洲产国偷v产偷v自拍| 久久久噜噜噜久久中文字幕色伊伊 | 国产91富婆露脸刺激对白| 精品国内二区三区| 国产丶欧美丶日本不卡视频| 精品国产麻豆免费人成网站| 国产在线视频不卡二| 久久久.com| 97久久超碰国产精品电影| 亚洲女爱视频在线| 欧美日本一区二区三区四区| 性做久久久久久| 欧美一二三区在线| 91福利精品视频| 午夜国产不卡在线观看视频| 9191成人精品久久| 精品一区二区在线播放| 中文一区在线播放| 欧美日韩精品三区| 成人看片黄a免费看在线| 中文字幕在线观看一区二区| 亚洲不卡一区二区三区| 欧美精品国产精品| 久久99久久久久久久久久久| 欧美经典一区二区| 在线观看亚洲成人| 精品一区二区综合| 中文字幕一区二区视频| 欧美精品久久99| 国产九九视频一区二区三区| 国产精品亲子伦对白| 欧美日韩美少妇| 国产在线视视频有精品| 亚洲欧美视频在线观看| 日韩一区二区在线播放| 99久久精品免费| 蜜臀99久久精品久久久久久软件| 国产婷婷一区二区| 欧美理论片在线| 成人av电影在线网| 久久精品国产精品亚洲综合| 中文字幕一区二区在线观看| 精品久久一二三区| 欧美色网一区二区| 94-欧美-setu| 国产成人在线视频免费播放| 丝袜美腿亚洲一区| 亚洲婷婷综合色高清在线| 精品国产电影一区二区| 在线观看成人免费视频| 成人爱爱电影网址| 国产一区二区三区精品欧美日韩一区二区三区| 亚洲免费高清视频在线| 国产性做久久久久久| 欧美大白屁股肥臀xxxxxx| 欧美性三三影院| 91在线国产观看| 成人精品小蝌蚪| 91麻豆福利精品推荐| 久久91精品国产91久久小草| 婷婷综合在线观看| 亚洲一区在线看| 最新成人av在线| 国产精品美女久久久久久久久久久| 精品第一国产综合精品aⅴ| 欧美精品自拍偷拍动漫精品| 欧美视频精品在线观看| 欧美影片第一页| 欧美性大战久久| 欧美日韩一二区| 欧美日韩一区不卡| 在线不卡的av| 日韩一区二区三区免费看| 91精品国产入口| 欧美丰满少妇xxxxx高潮对白| 欧美日韩精品欧美日韩精品| 欧美精选在线播放| 欧美一级日韩一级| 日韩欧美视频在线| xnxx国产精品| 国产精品福利一区| 一区二区三区日韩在线观看| 亚洲精品va在线观看| 亚洲午夜国产一区99re久久| 午夜精品视频一区| 日韩专区在线视频| 九色综合狠狠综合久久| 久久草av在线| 成人在线一区二区三区| 91免费看视频| 欧美区视频在线观看| 7777精品伊人久久久大香线蕉 | 亚洲精品一区二区三区福利| 日韩一级免费一区| 欧美岛国在线观看| 久久久不卡网国产精品一区| 中文字幕在线不卡国产视频| 夜夜亚洲天天久久| 美腿丝袜一区二区三区| 岛国精品在线播放| 欧美日韩亚洲综合| 国产区在线观看成人精品| 国产精品欧美综合在线| 日本免费新一区视频| 狠狠色综合播放一区二区| 成人黄页毛片网站| 欧美剧在线免费观看网站| 久久亚洲二区三区| 亚洲一区二区三区四区五区中文| 婷婷一区二区三区| 风间由美一区二区av101| 欧美三级乱人伦电影| 久久综合九色综合久久久精品综合| 亚洲色图第一区| 美女视频一区二区三区| 91在线无精精品入口| 精品久久久久久久人人人人传媒 | 激情文学综合丁香| 91在线看国产| 久久久美女艺术照精彩视频福利播放| 亚洲天堂中文字幕| 韩国欧美国产一区| 欧美人牲a欧美精品| 亚洲欧美日韩一区二区三区在线观看 |