bash调用-启动文件-交互式shell-条件表达式-shell算术-别名-数组-目录栈-提示符控制-受限shell-posix模式

受限shell  bash --restricted  它用来建立一个环境,比标准shell能有更多的控制。

posix模式  bash --posix

pushd ,popd,dirs
这几个命令可以使得工作目录书签化,就是可以按照顺序向前或者是向后移动工作目录,压栈的动作可以保存工作目录列表。
对于那些对当前的工作目录没有进行硬编码,并且需要对当前的工作目录做灵活的变动的脚本来说,这是很有用的命令。
注意:内建的$DIRSTACK数组变量,这个变量可以在脚本内存取,并且他们保存了目录栈的内容。

#!/bin/bash
dir1=/usr/bin
dir2=/var/spool
pushd $dir1
echo "Now in directory `pwd`."
pushd $dir2
echo "Now in directory `pwd`."
echo "The top entry in the DIRSTACK array is $DIRSTACK."
popd
echo "Now in directory `pwd`."
popd
echo "Now in directory `pwd`."

bash feature的更多相关文章

  1. In the shell, what does “ 2>&1 ” mean?

    In a Unix shell, if I want to combine stderr and stdout into the stdout stream for further manipulat ...

  2. 转: windows 10使用原生linux bash命令行

    转: https://www.zybuluo.com/pandait/note/337430 windows 10使用原生linux bash命令行 linux bash windows-10 第一时 ...

  3. Bash's ArithmeticExpression

    [Bash's ArithmeticExpression] let command: let a=17+23 echo "a = $a" # Prints a = 40 let a ...

  4. Bash String Manipulation Examples – Length, Substring, Find and Replace--reference

    In bash shell, when you use a dollar sign followed by a variable name, shell expands the variable wi ...

  5. Linux Bash环境下单引(')、双引号(")、反引号(`)、反斜杠(\)的小结

    在bash中,$.*.?.[.].’.”.`.\.有特殊的含义.类似于编译器的预编译过程,bash在扫描命令行的过程中,会在文本层次上,优先解释所有的特殊字符,之后对转换完成的新命令行,进行内核的系统 ...

  6. Unix Shells: Bash, Fish, Ksh, Tcsh, Zsh

    Hyperpolyglot Unix Shells: Bash, Fish, Ksh, Tcsh, Zsh grammar | quoting and escaping | charactersvar ...

  7. Bash Scripting Learn Notes

    References: [1] http://www.tldp.org/LDP/Bash-Beginners-Guide/html/ 1. Executing programs from a scri ...

  8. Windows10 RedStone 1使用Bash体验

    很多年前,记得在Windows Server2008的Feature里发现了Windows Subsystem For Unix,当时也不知道干啥用的,还以为是Samba协议用的呢. 今天,发现Win ...

  9. lsof and dynamic array in bash/shell

    https://unix.stackexchange.com/questions/171519/lsof-warning-cant-stat-fuse-gvfsd-fuse-file-system F ...

随机推荐

  1. 【LeetCode OJ】LRU Cache

    Problem Link: http://oj.leetcode.com/problems/lru-cache/ Long long ago, I had a post for implementin ...

  2. codeforces 597C (树状数组+DP)

    题目链接:http://codeforces.com/contest/597/problem/C 思路:dp[i][j]表示长度为i,以j结尾的上升子序列,则有dp[i][j]= ∑dp[i-1][k ...

  3. 并列div自动等高

    并列div自动等高 方法一:css控制 <!DOCTYPE html> <html lang="en"> <head> <meta cha ...

  4. 微软官方好用的Office 2003、 Office 2007 或 Office 2010 卸载工具

    http://support.microsoft.com/kb/2519420/zh-cn

  5. Xen虚拟机磁盘镜像模板制作(四)—CentOS 7

    在<Xen虚拟机磁盘镜像模板制作(三)—CentOS 7>一文中,我们已经成功制作出了 CentOS7 磁盘镜像.下面我们说明下如何通过它来生成目标虚拟机,同时测试下之前制作好的虚拟机磁盘 ...

  6. pcr free library 介绍

    一句话:illumina的建库方法,建库时间段,质量还好... the adapters are different in the PCR-free kit compared to the stand ...

  7. Python编程小记

    发现这种结构很实用: while True: expression .... if condition: expression break 好吧,我承认我是菜鸟-

  8. 检测到在集成的托管管道模式下不适用的 ASP.NET 设置的解决方法

    在将应用程序从经典模式迁移到集成模式时,可以保留经典模式下的自定义模块和处理程序注册,也可以将这些注册移除.如果不移除经典模式下使用的 httpModules 和 httpHandlers 注册,则必 ...

  9. .NET 里 静态方法的并发处理

    静态方法在程序运行时 就已经实例化好了 不管多少用户并发 都一样处理,不需要排队等待,实例代码: namespace DotNet.Example { using DotNet.BaseManager ...

  10. 正则表达式入门教程&&经典Javascript正则表达式(share)

    前言 例子: ^.+@.+\\..+$ 这样的代码曾经多次把我自己给吓退过.可能很多人也是被这样的代码给吓跑的吧.继续阅读本文将让你也可以自由应用这样的代码. 正文 教程:正则表达式30分钟入门教程 ...