小编Fre*_*rik的帖子

如果grep找到了它正在寻找的东西,那就做X else Y.

在这个语句中我试图匹配路径/ app/$ var1(应用程序名称)中是否存在版本($ var2)

if 
find /app/$var1 -maxdepth 1 -type l -o -type d | grep $var2 #results in a nice list where i can manually get a true match.
# if match is found then execute command.
$realcmd "$@"
    rc=$?
    exit $rc
else
echo "no match, the version you are looking for does not exist"
fi
Run Code Online (Sandbox Code Playgroud)

当前代码:这包括我的所有代码(未清除).命令我运行:"./ xmodule load firefox/3.6.12"此版本确实退出

#!/bin/bash
# hook for some commands

#echo $@  #value of sting that is entered after "xmodule"

cmd=$(basename "$0")
#echo …
Run Code Online (Sandbox Code Playgroud)

bash grep

20
推荐指数
2
解决办法
5万
查看次数

标签 统计

bash ×1

grep ×1