introduction

In certain situations, quotes are required to be output in the command prompt. To do this, you may say why don’t use single quotes. Basically, that is able to handle most cases. However, single quotes prevent parsing environment variables. In this blog, we present a simple way to handle outputing quotes while parsing specifiled environment variables.


the method

Firstly, we use single quotes:

echo 'hello "margin"'

the output showing below:

hello “margin”

Try to display environment variables:

echo '"hello $PATH"'

outputs

“hello $PATH”

If we prefer the content of PATH!

echo '"'hello $PATH'"'

result is :

“hello /usr/sbin:/usr/bin:/sbin:/bin”

Pay your attention on the first 3 characters after echo, and the last 3 characters! They are ', ", '!!!!

Do I make sense? Have any question? Do not hesitate to ask me~

how to output quotes in bash prompt的更多相关文章

  1. bash shell命令行选项与修传入参数处理

    在编写shell程序时经常需要处理命令行参数,本文描述在bash下的命令行处理方式.选项与参数:如下命令行: ./test.sh -f config.conf -v --prefix=/home -f ...

  2. 【转】Bash Shell中命令行选项/参数处理

    原文网址:http://www.cnblogs.com/FrankTan/archive/2010/03/01/1634516.html 0.引言 写程序的时候经常要处理命令行参数,本文描述在Bash ...

  3. Bash Shell中命令行选项/参数处理

    0.引言 写程序的时候经常要处理命令行参数,本文描述在Bash下的命令行处理方式. 选项与参数: 如下一个命令行: ./test.sh -f config.conf -v --prefix=/home ...

  4. 脚本乐园 Shell中命令行选项和参数的处理

    在Linux的Shell中怎样处理tail -n 10 access.log这样的命令行选项呢?这是被别人问起的一个问题,好好学习了一下,进行总结如下:在bash中,可以用以下三种方式来处理命令行参数 ...

  5. [记录]Shell中的getopts和getopt用法

    Shell中的getopts和getopt用法 1.getopts getopts(shell内置命令)不能直接处理长的选项(如:--prefix=/home等),getopts有两个参数,第一个参数 ...

  6. Shell script 传参数处理(默认变量)

    变量 含义 $0:shell脚本的名字: $1 位置参数 #1 $2 - $9 位置参数 #2 - #9 ${10} 位置参数 #10 "$*" :代表"$1c$2c$3 ...

  7. getopts的使用

    getopts的使用 语法格式:getopts [option[:]] [DESCPRITION] VARIABLE option:表示为某个脚本可以使用的选项 ":":如果某个选 ...

  8. Shell 参数(2) --解析命令行参数工具:getopts/getopt

    getopt 与 getopts 都是 Bash 中用来获取与分析命令行参数的工具,常用在 Shell 脚本中被用来分析脚本参数. 两者的比较 (1)getopts 是 Shell 内建命令,geto ...

  9. shell脚本读取命令行的参数

    转至:https://www.cnblogs.com/eternityz/p/13879836.html 前提 在编写shell程序时经常需要处理命令行参数 选项与参数: 如下命令行: ./test. ...

随机推荐

  1. WPF Command

    使用CustomControl时绑定Command用法 C# Part public static RoutedUICommand ClearCommand { get; private set; } ...

  2. 【推荐】CentOS修复OpenSSH用户枚举漏洞

    注:以下所有操作均在CentOS 6.8 x86_64位系统下完成. #漏洞说明# OpenSSH(OpenBSD Secure Shell)是OpenBSD计划组所维护的一套用于安全访问远程计算机的 ...

  3. 三 Django模型层之Meta

    模型的Meta选项 本文阐述所有可用的元数据选项,你可以在模型的Meta类中设置他们 Meta选项 abstract 如果为True,就表示抽象基类 app_label 如果模型在INSTALLED_ ...

  4. 再深刻理解下web3.js中estimateGas如何计算智能合约消耗的gas量

    我们可使用web3.js框架的estimateGas函数获得一个以太坊智能合约的Gas估计值 ,通过执行一个消息调用或交易,该消息调用或交易直接在节点的VM中执行,并未在区块链中确认,函数会返回估算使 ...

  5. [NOIp 2009]靶形数独

    Description 小城和小华都是热爱数学的好学生,最近,他们不约而同地迷上了数独游戏,好胜的他们想用数独来一比高低.但普通的数独对他们来说都过于简单了,于是他们向 Z 博士请教,Z 博士拿出了他 ...

  6. [Codeforces 448C]Painting Fence

    Description Bizon the Champion isn't just attentive, he also is very hardworking. Bizon the Champion ...

  7. [USACO12FEB]牛的IDCow IDs

    题目描述 Being a secret computer geek, Farmer John labels all of his cows with binary numbers. However, ...

  8. bzoj1094[ZJOI2007]粒子运动 计算几何

    1094: [ZJOI2007]粒子运动 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 658  Solved: 164[Submit][Status ...

  9. [bzoj2648/2716]SJY摆棋子

    平面上有n个点,要求支持插入一个点和查询一个点的最近点距离 n,m<=500000 用kdtree实现,但是复杂度貌似没法保证.....(莫名加了替罪羊重建更慢了...) #include< ...

  10. IP地址、子网掩码、网关、DNS服务器

    1. IP地址 IP是英文Internet Protocol的缩写,意思是"网络之间互连的协议",也就是为计算机网络相互连接进行通信而设计的协议.在因特网中,它是能使连接到网上的所 ...