我试图用cdargs包理解"cdargs-bash.sh"脚本.我在以下函数中有一个问题:
function _cdargs_get_dir ()
{
local bookmark extrapath
# if there is one exact match (possibly with extra path info after it),
# then just use that match without calling cdargs
if [ -e "$HOME/.cdargs" ]; then
dir=`/bin/grep "^$1 " "$HOME/.cdargs"`
if [ -z "$dir" ]; then
bookmark="${1/\/*/}"
if [ "$bookmark" != "$1" ]; then
dir=`/bin/grep "^$bookmark " "$HOME/.cdargs"`
extrapath=`echo "$1" | /bin/sed 's#^[^/]*/#/#'`
fi
fi
[ -n "$dir" ] && dir=`echo "$dir" | /bin/sed 's/^[^ ]* //'`
fi
if …Run Code Online (Sandbox Code Playgroud) 当我使用命令时:
easy_install spotter
安装spotter包,我收到以下错误信息
Searching for spotter
Reading http://pypi.python.org/simple/spotter/
Download error on http://pypi.python.org/simple/spotter/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
Reading http://pypi.python.org/simple/spotter/
Download error on http://pypi.python.org/simple/spotter/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
Couldn't find index page for 'spotter' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
Download error on http://pypi.python.org/simple/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
No local …Run Code Online (Sandbox Code Playgroud) 当我阅读wget的联机帮助页时,我遇到了"--delete-after"选项?提供这种选择的目的是什么?它只是用于测试页面是否可以下载?或者也许还有其他情况,这个选项很有用,我希望你们可以给我一些提示.
该ls命令的联机帮助页说:
-d, --directorylist
directory entries instead of contents.
Run Code Online (Sandbox Code Playgroud)
那么,目录内容和条目之间的区别是什么?ls -d我的主目录中的命令仅显示:
.
Run Code Online (Sandbox Code Playgroud)
命令-d选项的目的是什么ls?
我想ncread在当前目录及其子目录下的每个.m文件中找到所有出现的内容.我使用以下命令:
grep -R --include="\.m" ncread .
Run Code Online (Sandbox Code Playgroud)
但是命令会返回nothings.grep的联机帮助页说:
--include=GLOB
Search only files whose basename matches GLOB
Run Code Online (Sandbox Code Playgroud)
为什么它不起作用?谢谢!
我似乎陷入了矛盾的境地.我有一个长字符串存储在一个变量中,$abstract如下所示:
abstract='test1 and "test2"'
Run Code Online (Sandbox Code Playgroud)
你看到字符串中有一个引号,我想把这个字符串作为一个参数发送到一个命令,我尝试了以下命令:
command_name "$abstract"
Run Code Online (Sandbox Code Playgroud)
在变量替换之后,它变成:command_name test1 and "test2".如果我尝试:
command_name \"$abstract\"
Run Code Online (Sandbox Code Playgroud)
它变成:command_name "test1 and "test2"".两者都不是我想要的.谁能告诉我如何实现我的目标?
bash ×3
directory ×1
easy-install ×1
filesystems ×1
grep ×1
include ×1
ls ×1
newline ×1
proxy ×1
python ×1
substitution ×1
wget ×1