无法从bash运行expect脚本

时间:2015-11-28 19:46:43

标签: linux bash expect

我试图从bash调用expect脚本但是我收到以下错误:

+ cd /usr/local/sbin/myscripts
+ exec transfer_single_cert.expct jw.jwebster
./resend_keys.sh: line 131: exec: transfer_single_cert.expct: not found

这是bash:

#!/bin/bash

...other code
cd /usr/local/sbin/myscripts
exec transfer_single_cert.expct $usern

为什么会出现上述错误? 文件名是正确的。

我也试过

exec /usr/bin/bash /usr/local/sbin/myscripts/transfer_single_cert.expct $usern
./transfer_single_cert.expct $usern

1 个答案:

答案 0 :(得分:0)

我想答案是:默认情况下,当前目录不在搜索PATH中,因为transfer_single_cert.expct无法找到transfer_single_cert.expct

所以调用./transfer_single_cert.expct作为chmod +x transfer_single_cert.expct(并确保它具有可执行位(expect),并且期望脚本的第一行是shebang,位置正确expect transfer_single_cert.expct。 或者只使用# make some data with categories a and b library(dplyr) df = expand.grid( a = LETTERS[1:3], index = 1:10 ) # add a variable that changes within each group set.seed(9999) df$x = runif(nrow(df)) # get the variance of a subset of x varSubset = function(x, index, subsetSize) { subset = (index-subsetSize+1):index ifelse(subset[1]<1, -1, var(x[subset])) } df %>% # group the data group_by(a) %>% # get the variance of the 3 most recent values mutate(var3 = varSubset(x, index, 3))