'〜''''和' - >之间有什么区别? 〜'在Ubuntu shell中?

时间:2016-10-29 14:13:01

标签: shell ubuntu

 ~ sh
$ dash
$ quit
dash: 1: quit: not found
$ bash
dblab@slave1-hadoop:~$ exit
exit
$ exit
$

任何答案都将不胜感激。

2 个答案:

答案 0 :(得分:0)

您的默认shell - >是zsh,当你输入sh,ubuntu默认shell是破折号,你可以通过

获得它
ls -l /bin/sh 
output:
/bin/sh -> /bin/dash

quit不是破折号的命令,当你输入bash命令时,你进入bash环境,exit是bash命令,如果你想获得相同的结果你可以改变/ bin / sh符号链接到/ bin / bash。

答案 1 :(得分:0)

两者都是shell提示,一个是dash,另一个是bashbashdash都可以设置为具有相同的启动提示,(不是您想要的,但要显示它可以完成,这表明了此类提示的任意性质),调整$PS1变量。来自man bash

   PS1    The value of this parameter is expanded  (see  PROMPTING  below)
          and  used  as  the  primary prompt string.  The default value is
          ``\s-\v\$ ''.
   PS2    The value of this parameter is expanded as with PS1 and used  as
          the secondary prompt string.  The default is ``> ''.
   PS3    The value of this parameter is used as the prompt for the select
          command (see SHELL GRAMMAR above).
   PS4    The value of this parameter is expanded  as  with  PS1  and  the
          value  is  printed  before  each command bash displays during an
          execution trace.  The first character of PS4 is replicated  mul‐
          tiple  times, as necessary, to indicate multiple levels of indi‐
          rection.  The default is ``+ ''.

尝试在fordash中运行下面的bash循环,以打印各种级别的提示(在两个冒号之间显示空格)。以下是dash显示的内容:

for f in PS1 PS2 PS3 PS4 ; do eval echo :\$$f: ; done
:$ :
:> :
::
:+ :