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. JS监听关闭浏览器事件

    Onunload与Onbeforeunload Onunload,onbeforeunload都是在刷新或关闭时调用,可以在<script>脚本中通过window.onunload来指定或 ...

  2. 实现:TextView自由复制功能

    源代码已经上传,链接地址:http://download.csdn.net/detail/huangyabin001/7556825 点击打开链接 package com.example.copyfr ...

  3. 【LeetCode OJ】Insertion Sort List

    Problem: Sort a linked list using insertion sort. The node of the linked list is defined as: /** * D ...

  4. Thread和Service应用场合的区别

    Thread和Service的区别: 1) Thread 是程序执行的最小单元,它是分配CPU的基本单位,可以用 Thread 来执行一些异步的操作. 如果是Local Service,那么对应的 S ...

  5. XMPP协议的原理介绍

    XMPP(可扩展消息处理现场协议)是基于可扩展标记语言(XML)的协议,它用于即时消息(IM)以及在线现场探测.它在促进服务器之间的准即时操作.这个协议可能最终允许因特网用户向因特网上的其他任何人发送 ...

  6. WPF Step By Step 系列 - 开篇 ·

    WPF Step By Step 系列 - 开篇 公司最近要去我去整理出一个完整的WPF培训的教程,我刚好将自己学习WPF的过程和经验总结整理成笔记的方式来讲述,这里就不按照书上面的东西来说了,书本上 ...

  7. DNS劫持 DNS污染

    编号:1021时间:2016年6月24日17:23:50功能:DNS劫持 DNS污染URL:http://www.itechzero.com/dns-hijacking-dns-pollution-i ...

  8. ng-init

  9. OpenMP的简单使用教程

    转自:http://binglispace.com/2015/01/09/openmp-intro/ OpenMP的简单使用教程 今天有幸参加了一个XSEDE OpenMP的workshop讲座,真是 ...

  10. 第四部分:python性能技巧

    4.1 查询操作为主时,选择字典结构比list结构效率更高 4.2 取list的交集.并集.差集时,可借助set数据结构如listintersection = list(set(lista)& ...