Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
shell脚本在终端中执行,但不需要双击ubuntu_Shell_Ubuntu - Fatal编程技术网

shell脚本在终端中执行,但不需要双击ubuntu

shell脚本在终端中执行,但不需要双击ubuntu,shell,ubuntu,Shell,Ubuntu,因此,我的桌面上有一个shell脚本,当它在终端中运行时,它可以完美地执行: Pullab.sh 但当我试图双击它时,它就崩溃了。 代码: 有什么想法吗 提前谢谢 找不到程序adb 在程序所在的终端中确定: which adb 然后用这些值替换脚本中的adb调用,对于exmaple: /usr/bin/adb pull /sdcard/MovingGratings ~/Documents/AndroidData/MovingGratings /usr/bin/adb pull

因此,我的桌面上有一个shell脚本,当它在终端中运行时,它可以完美地执行: Pullab.sh

但当我试图双击它时,它就崩溃了。 代码:

有什么想法吗


提前谢谢

找不到程序
adb

在程序所在的终端中确定:

which adb
然后用这些值替换脚本中的
adb
调用,对于exmaple:

/usr/bin/adb pull /sdcard/MovingGratings         ~/Documents/AndroidData/MovingGratings
/usr/bin/adb pull /sdcard/LoomingDot             ~/Documents/AndroidData/LoomingDot
...

谢谢现在可以了。我只是不明白为什么它通过在终端窗口中运行文件来工作,但需要双击adb程序的显式完整路径。有什么想法吗?这是因为搜索程序的环境变量是
$PATH
。双击脚本时,此变量中并非所有路径都与终端中的路径相同。
/usr/bin/adb pull /sdcard/MovingGratings         ~/Documents/AndroidData/MovingGratings
/usr/bin/adb pull /sdcard/LoomingDot             ~/Documents/AndroidData/LoomingDot
...