如果您想了解bash–由Cygwin打印不可打印的字符的相关知识,那么本文是一篇不可错过的文章,我们将对不能打印输出的对象进行全面详尽的解释,并且为您提供关于(ConEmuCygwin)如何在cygw
如果您想了解bash – 由Cygwin打印不可打印的字符的相关知识,那么本文是一篇不可错过的文章,我们将对不能打印输出的对象进行全面详尽的解释,并且为您提供关于(ConEmu Cygwin)如何在cygwin bash脚本中更改ConEmu的选项卡名称、Bash Shell;读命令;在Windows 7上使用Cygwin、bash – Cygwin git选项卡完成、bash – Cygwin启动脚本的有价值的信息。
本文目录一览:- bash – 由Cygwin打印不可打印的字符(不能打印输出的对象)
- (ConEmu Cygwin)如何在cygwin bash脚本中更改ConEmu的选项卡名称
- Bash Shell;读命令;在Windows 7上使用Cygwin
- bash – Cygwin git选项卡完成
- bash – Cygwin启动脚本
bash – 由Cygwin打印不可打印的字符(不能打印输出的对象)
usr@R923047 ~ $head -3 test.ctl row 1 row 2 row 3 usr@R923047 ~ $head -3 test.ctl | cat -nv 1 row 1^M 2 row 2^M 3 row 3 usr@R923047 ~ $head -3 test.ctl | grep '[^[:print:]]' usr@R923047 ~ $head -3 test.ctl | grep '[[:cntrl:]]' usr@R923047 ~
解决方法
Treat the file(s) as binary. By default,under MS-DOS and MS-Windows,
grep
guesses the file
type by looking at the contents of the first 32KB read from the file. Ifgrep
decides the
file is a text file,it strips the CR characters from the original file contents (to make
regular expressions with^
and$
work correctly). Specifying-U
overrules this guesswork,
causing all files to be read and passed to the matching mechanism verbatim; if the file is a
text file with CR/LF pairs at the end of each line,this will cause some regular expressions
to fail. This option has no effect on platforms other than MS-DOS and MS-Windows.
所以:
$head -3 test.ctl row 1 row 2 row 3 $head -3 test.ctl | cat -nv 1 row 1^M 2 row 2^M 3 row 3 $head -3 test.ctl | grep '[^[:print:]]' $head -3 test.ctl | grep '[[:cntrl:]]' $head -3 test.ctl | grep -U '[^[:print:]]' row 1 row 2 $head -3 test.ctl | grep -U '[[:cntrl:]]' row 1 row 2
(ConEmu Cygwin)如何在cygwin bash脚本中更改ConEmu的选项卡名称
bash --login -i my_ssh_entry_script.sh
在my_ssh_entry_script.sh中,它将读取我的主目录中的配置文件,然后打印一个菜单供我选择要连接的主机.最后
... exec ssh -p$port $userhost
现在我可以在同一个conemu选项卡中处理选定的机器.这很好用.而且脚本也适用于linux机器.
但是有一点缺陷.我无法更改标签的标题.我试图将其更改为:
.... exec $(cygpath ${ConEmuDir})/ConEmu.exe /cmd ssh -p$port $userhost -cur_console:t:$title
但这将始终创建一个新选项卡.有什么建议可以解决它吗?谢谢〜
http://conemu.github.io/en/GuiMacro.html
ConEmuC -GuiMacro Rename 0 "Title"
2)您不需要运行批处理.它会在您的进程树中导致额外且无用的cmd.exe.您可以直接从任务内容中执行所有必需的“CD”和“SET”.
Bash Shell;读命令;在Windows 7上使用Cygwin
所以我尝试了这个:
#!/bin/bash echo -e "Enter your name and press [ENTER]: \c" read var_name echo "Your name is: $var_name"
然后我将运行它并输入var_name的名称.
我明白了:
$./project1.sh Enter your name and press [ENTER]: Jake ': not a valid identifierad: `var_name Your name is:
据我所知,我遇到了阅读问题.我正在尝试为我的课程开展一个项目,但我似乎无法弄清楚为什么它不会读它.我毫不夸张地跟着这本书,然后在网上使用这些似乎对我不起作用的例子.有没有人知道这是我的设置还是我错过了什么,谢谢.
我建议这是因为该行:
': not a valid identifierad: `var_name
看起来像两条线一样可疑:
.........................ad: `var_name ': not a valid identifier
合并在一起(.字符表示已被覆盖的内容).
如果你在该行中的变量是var_namecarriage-return而不是更正常的var_name,那就是这种情况.
事实上它是Cygwin也指出了这个结论,因为当你使用Windows编辑器编辑你的脚本时经常遇到麻烦,这个编辑器使用CR / LF,其中Cygwin只需要LF.
我怀疑你会发现在你的实际脚本上做一个od -xcb表明你在一个或多个脚本行上有那些Windows行结尾.
事实上,我刚刚在Ubuntu下通过在读取行的末尾放置一个CTRL-M并输出(稍微修改以显示CTRL-M)来测试它:
pax@pax-desktop:~$od -xcb qq.sh ; ./qq.sh 0000000 2123 622f 6e69 622f 7361 0a68 6365 6f68 # ! / b i n / b a s h \n e c h o 043 041 057 142 151 156 057 142 141 163 150 012 145 143 150 157 0000020 2d20 2065 4522 746e 7265 7920 756f 2072 - e " E n t e r y o u r 040 055 145 040 042 105 156 164 145 162 040 171 157 165 162 040 0000040 616e 656d 6120 646e 7020 6572 7373 5b20 n a m e a n d p r e s s [ 156 141 155 145 040 141 156 144 040 160 162 145 163 163 040 133 0000060 4e45 4554 5d52 203a 635c 2022 720a 6165 E N T E R ] : \ c " \n r e a 105 116 124 105 122 135 072 040 134 143 042 040 012 162 145 141 0000100 2064 6176 5f72 616e 656d 0a0d 6365 6f68 d v a r _ n a m e \r \n e c h o ^^ 144 040 166 141 162 137 156 141 155 145 015 012 145 143 150 157 0000120 2220 6f59 7275 6e20 6d61 2065 7369 203a " Y o u r n a m e i s : 040 042 131 157 165 162 040 156 141 155 145 040 151 163 072 040 0000140 7624 7261 6e5f 6d61 2265 0a0a $ v a r _ n a m e " \n \n 044 166 141 162 137 156 141 155 145 042 012 012 0000154 Enter your name and press [ENTER]: pax ': not a valid identifierar_name Your name is:
换句话说,与您所看到的非常相似.
顺便说一句(现在我可以访问我的Cygwin环境),你看到的是输出:
abcdefghij.sh: line 99 read: `var_name `: not a valid identifier
第二行覆盖第一行,给出:
`: not a valid identifierad: `var_name
换句话说,奇怪的单词identifyierad实际上由标识符和最终广告组成:来自:之所以与上面的例子相似(而不是精确)是因为你的文件名和行号与我的小测试脚本不同.
bash – Cygwin git选项卡完成
我做了一些搜索,发现一个说明,默认情况下没有启用。我将skel .bashrc和.bash_profile复制到〜和.bashrc中,我取消注释完成的行,然后重新启动控制台。依然没有。
然后我注意到/ etc中没有文件.bash_completion,所以我找到了一个在线的副本,并将其放在适当位置,但是我仍然没有在git中完成。
似乎还应该有一个/etc/bash_completion.d目录,其中有git /,但我也没有。
bash – Cygwin启动脚本
我想要自动添加一些挂载,并在启动时运行cygwin中的其他脚本.我看到在linux中,就像在etc / init.d中添加一个shell文件一样简单
但是,我尝试添加这个目录和chmod x添加一个shell,chmod这个shell文件,但是不起作用.
另外,如果有一种方法来运行脚本,如关闭umount,rmdir等.
~/.bash_profile
AKA
C:\cygwin\home\CPJ\.bash_profile
有了库存安装,这个文件是在Cygwin启动时读取的.如果你想添加更多的文件,你可以编辑.bash_profile文件
source foo.sh source bar.sh source baz.sh
Bash man page
关于bash – 由Cygwin打印不可打印的字符和不能打印输出的对象的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于(ConEmu Cygwin)如何在cygwin bash脚本中更改ConEmu的选项卡名称、Bash Shell;读命令;在Windows 7上使用Cygwin、bash – Cygwin git选项卡完成、bash – Cygwin启动脚本的相关信息,请在本站寻找。
本文标签: