how to output quotes in bash prompt
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的更多相关文章
- bash shell命令行选项与修传入参数处理
在编写shell程序时经常需要处理命令行参数,本文描述在bash下的命令行处理方式.选项与参数:如下命令行: ./test.sh -f config.conf -v --prefix=/home -f ...
- 【转】Bash Shell中命令行选项/参数处理
原文网址:http://www.cnblogs.com/FrankTan/archive/2010/03/01/1634516.html 0.引言 写程序的时候经常要处理命令行参数,本文描述在Bash ...
- Bash Shell中命令行选项/参数处理
0.引言 写程序的时候经常要处理命令行参数,本文描述在Bash下的命令行处理方式. 选项与参数: 如下一个命令行: ./test.sh -f config.conf -v --prefix=/home ...
- 脚本乐园 Shell中命令行选项和参数的处理
在Linux的Shell中怎样处理tail -n 10 access.log这样的命令行选项呢?这是被别人问起的一个问题,好好学习了一下,进行总结如下:在bash中,可以用以下三种方式来处理命令行参数 ...
- [记录]Shell中的getopts和getopt用法
Shell中的getopts和getopt用法 1.getopts getopts(shell内置命令)不能直接处理长的选项(如:--prefix=/home等),getopts有两个参数,第一个参数 ...
- Shell script 传参数处理(默认变量)
变量 含义 $0:shell脚本的名字: $1 位置参数 #1 $2 - $9 位置参数 #2 - #9 ${10} 位置参数 #10 "$*" :代表"$1c$2c$3 ...
- getopts的使用
getopts的使用 语法格式:getopts [option[:]] [DESCPRITION] VARIABLE option:表示为某个脚本可以使用的选项 ":":如果某个选 ...
- Shell 参数(2) --解析命令行参数工具:getopts/getopt
getopt 与 getopts 都是 Bash 中用来获取与分析命令行参数的工具,常用在 Shell 脚本中被用来分析脚本参数. 两者的比较 (1)getopts 是 Shell 内建命令,geto ...
- shell脚本读取命令行的参数
转至:https://www.cnblogs.com/eternityz/p/13879836.html 前提 在编写shell程序时经常需要处理命令行参数 选项与参数: 如下命令行: ./test. ...
随机推荐
- sumo快速运行简单仿真实例详细教程
本文旨在让大家快速的了解sumo,并给出运行一个简单的sumo的例子的教程,进而了解基本sumo工程的架构,使大家对该软件产生兴趣并持续学习下去,刚开始学习仿真的确枯燥,项目"跑起来&quo ...
- 学习React系列(三)——Refs和Dom
一.适用于以下场景: 1.控制焦点,文本选择,或者媒体控制 2.触发必要的动画 3.整合第三方dom库 二.不要过度使用ref 如果想通过ref来改变state,那么换一种方式-变量提升可能会更好. ...
- JDK安装、变量、变量的分类
Lesson One 2018-04-17 19:50:35 JAVA语言特点: 编译型.强类型语言. 纯面向对象的语言,所有的代码都必须包含在class中的方法中 配置JAVA环境变量 1.安装J ...
- python-复杂生成式
1.复杂的列表生成式HTML表格: 注:字符串可以通过%进行格式,用指定的参数化代替%s.字符串的join()方法可以把一list拼接成一个字符串. 把没有几个的分数标记为红色: d = { 'Ada ...
- 【Swift】swift定义全局变量
swift定义全局变量非常简单哈,只要在类class上面直接定义,就是全局变量了 当需要在类里面定义一个类函数访问的变量的时候,直接在var或者let 前面加一个 static
- hihoCoder 1595 : Numbers
Description You are given n constant integers c[1], c[2], ..., c[n] and an integer k. You are to ass ...
- ●BZOJ 4176 Lucas的数论
题链: http://www.lydsy.com/JudgeOnline/problem.php?id=4176 题解: 莫比乌斯反演,杜教筛 首先有这么一个结论: 令d(n)表示n的约数的个数(就是 ...
- bzoj3944Sum
3944: Sum Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 5149 Solved: 1385[Submit][Status][Discuss ...
- bzoj3129[Sdoi2013]方程 exlucas+容斥原理
3129: [Sdoi2013]方程 Time Limit: 30 Sec Memory Limit: 256 MBSubmit: 582 Solved: 338[Submit][Status][ ...
- 勤拂拭软件Android开发之旅(1) 之 Android 开发环境搭建
勤拂拭软件工作室原创出品,欢迎转载,欢迎交流. 转载请注明原文:http://www.cnblogs.com/wangleiblog/p/6019063.html 勤拂拭软件Android开发之旅目录 ...