我有一个bash脚本,当我正常运行它时(使用cygwin窗口)可以正常工作。以下代码:
B=$2 #(ie. B="50602_15:56:31_15:56:11_15:56:21")
for line in ${B//;/ } ;
do
TENT=`echo ${line} | awk '{split($0,numbers,"_"); print numbers[1]}'`"_sim_fills.txt"
done
现在我正在尝试使用excel中的vba运行此脚本:
Public Sub test()
Dim cmd As String
Dim ret As Double
Dim WshShell As Object
Dim plink_object As Object
' Run Linux Commands
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
Set plink_object = WshShell.Run("C:\cygwin\bin\mintty.exe fills_new.sh 66 ""50602_15:56:31_15:56:11_15:56:21;50602_15:57:07_15:56:47_15:56:57""", 1)
On Error GoTo 0
End Sub
我收到错误:“awk: command not found
”。
有什么想法吗?
答案 0 :(得分:1)
正如@BroSlow建议我使用awk的完整路径并且它正常工作。
B=$2 #(ie. B="50602_15:56:31_15:56:11_15:56:21")
for line in ${B//;/ } ;
do
TENT=`echo ${line} | "/cygdrive/c/cygwin/bin/awk" '{split($0,numbers,"_"); print numbers[1]}'`"_sim_fills.txt"
done