我正在尝试使用sarge库执行shell脚本。
我的文件script.sh
包含以下内容:
#!/usr/bin/env sh
export LOCAL_PROJECT_ROOT=/path/to/the/dir
inotifywait -mr --exclude '(.git|.idea|node_modules)' \
-e modify,create,delete ${LOCAL_PROJECT_ROOT} --format '%w%f'
我和sarge一样运行它:
sarge.run('sh script.sh')
我看到htop
没有inotifywait
进程正在运行。
但是,当我使用sh script.sh
直接在shell中运行此脚本时,一切都按预期工作。
如果删除包含引用参数的--exclude
和--format
部分,sarge也可以运行。
如果我将脚本重写为这样的话,它也可以运行sarge:
echo "inotifywait -mr --exclude '(.git|.idea|node_modules)' -e modify,create,delete ${LOCAL_PROJECT_ROOT} --format '%w%f'" | /bin/sh
答案 0 :(得分:1)
听起来像模块问题。
因为:
private static char[][] ParseFile(string file)
{
string[] fileOne = File.ReadAllLines(file);
char[][] fileOut = {};
char[] fileOutLine;
for (int i = 0; i < fileTwo.Length ; i++)
{
string linew = fileTwo[i];
for (int j = 0; j < linew.Length; j++)
{
//Stuck here
}
}
return fileOut;
private static char TurntoChar(string s)
{
switch (s)
{
case "S":
return 'S';
break;
case "O":
return 'O';
break;
case "F":
return 'F';
break;
default:
return 'B';
break;
}
}
}
internal class Point
{
public Point(int x, int y)
{
X = x;
Y = y;
}
public int Y { get; set; }
public int X { get; set; }
}
}
也许:
Python 2.7.6 (default, Nov 23 2017, 15:49:48)
[GCC 4.8.4] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> 'a' == "a"
True
>>> '%s' %"'a'"
"'a'"
>>> "%s" %'"a"'
'"a"'
>>>
#!/usr/bin/env sh
export LOCAL_PROJECT_ROOT=/path/to/the/dir
inotifywait -mr --exclude "(.git|.idea|node_modules)" -e modify,create,delete ${LOCAL_PROJECT_ROOT} --format "%w%f"
,但您有“\\ n”\n
这对壳牌来说还不够。