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. linux基础命令学习(四)计划任务

    一.计划任务 crond服务简介 linux任务调度的工作主要分为以下两类: *系统执行的工作:系统周期性所要执行的工作,如备份系统数据.清理缓存 *个人执行的工作:某个用户定期要做的工作,例如每隔1 ...

  2. php大力力 [008节]局部表量

    2015-08-23 php大力力008. php局部表量 开始写简单程序,遇到几个小困难障碍. 第一个:不要少写最后一个问号❓ <?php echo 'HELLO WORLD';?> 程 ...

  3. php大力力 [007节]php静态表量

    2015-08-23 php大力力007. php静态表量 这里看一下高老师的视频讲解: 转帖: php中static静态类与static 静态变量用法区别 php中的静态变量的基本用法 转载 时间: ...

  4. codevs 5429 完全背包

    单调队列优化. 好像有点烦...调了许久. #include<iostream> #include<cstdio> #include<cstring> #inclu ...

  5. 待研究之iOS硬件调研

    1.磁力计 完成指南针 参考类:CLLocationManager,CLHeading 2.照相机 完成一个按钮点击拍照,拍照完使用照片,一个按钮打开系统相册 选择图片 参考类: UIImagePic ...

  6. ACE - Ubuntu下环境搭建

    之前写了很多linux下的底层网络API的demo,这些demo可用于了解底层的网络通信过程,但是想做出好的服务器用于实际业务还是非常困难的,需要大量的代码实现,移植性也非常差,想要写出高性能架构的服 ...

  7. mysql主从同步mysql slave_io_running:no的解决方案

    在主从同步的时候出现slave_io_running:no 问题,于是查看mysqld.log日志,发现时1042错误 解决方案: 编辑/etc/my.cnf,在:[mysqld]内添加一行:skip ...

  8. 第一个demo

    1.首先这是最初的概念模型. 2.最后设计成这样. 3.运行

  9. Sublime Text 2 安装主题的方法

    主题下载 下载一个主题,例如: https://github.com/hyspace/st2-reeder-theme 里面起作用的文件有两个: Reeder.sublime-theme Earths ...

  10. Dialog样式

    <style name="load_dialog" parent="@android:style/Theme.Dialog"> <item n ...