我正在尝试编写一个脚本,该脚本将目录作为命令行参数并遍历目录中的文件,将它们的扩展名更改为.bu.
我认为这会奏效,但我得到了输出 '.bu' is not a target directory
#!/bin/bash
for f in $1; do
mv "$f".* .bu
done
Run Code Online (Sandbox Code Playgroud) 使用 Ubuntu 13.10
我正在尝试使用 yeoman 安装,sudo npm install -g yo但它似乎不能在全局范围内工作npm并且nodejs已安装,但是,我不确定它们是否已正确安装以供全局使用。我不能使用npm我必须使用sudo npm
安装我使用的节点js
$ sudo apt-get install python-software-properties
$ sudo apt-add-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs
Run Code Online (Sandbox Code Playgroud)
当我使用sudo npm install -g yo输出时,我得到的是
/usr/bin/yo -> /usr/lib/node_modules/yo/cli.js
> yo@1.2.1 postinstall /usr/lib/node_modules/yo
> node ./scripts/doctor
[Yeoman Doctor] Everything looks alright!
yo@1.2.1 /usr/lib/node_modules/yo
??? is-root@0.1.0
??? fullname@0.1.1
??? opn@0.1.2
??? async@0.9.0
??? shelljs@0.3.0
??? lodash@2.4.1
??? multiline@0.3.4 (strip-indent@0.1.3)
??? sudo-block@0.4.0 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 sed 从此文件中删除等号并将其通过管道传输到新文件:
I am a file to be edited.
A unique file with my own words.
T=h=e=r=e a=r=e i=s=s=u=e=s w=i=t=h t=h=i=s l=i=n=e
Run Code Online (Sandbox Code Playgroud)
我试过了,cat FixMeWithSed.txt | sed 's/=//' > FileFixedWithSed.txt但它只替换了第一个等号。
I am a file to be edited.
A unique file with my own words.
Th=e=r=e a=r=e i=s=s=u=e=s w=i=t=h t=h=i=s l=i=n=e
Run Code Online (Sandbox Code Playgroud)
我不知道如何选择所有等号,而不仅仅是第一个。谢谢!