Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology

iApp Script "Exec" Command Quoting Error


I'm running into an issue with calling "exec" from an iApp script. I think it has to do with quoting arguments passed to "exec".

Here is the script error:

Saving active configuration...
Script (/Common/test) generated this Tcl error:
script did not successfully complete: (bash: mkdir -p /home/testuser/backup/: No such file or directory
    while executing
"exec ssh testuser@ -q 'mkdir -p /home/test/backup/'" line:13)

The command within the iApp script is:

exec ssh testuser@ -q 'mkdir -p /home/test/backup/'

I've tried putting the arguments in a list first but still got the same errors.

Can someone point me in the right direction?


Rate this Question

Answers to this Question


If it's the quote, try -q \'mkdir -p /home/test/backup/\'. But it may not be the quote. It may be the path, so next try -q '/bin/mkdir -p /home/test/backup/'.

Comments on this Answer
Comment made 25-Oct-2016 by strain17 4

Hi Fred,

Thanks for the response. I tried that and several other combinations before asking the question.

script did not successfully complete: (bash: /bin/mkdir -p /home/testuser/backup: No such file or directory
    while executing
"exec ssh scpadmin-f5@ -q \'/bin/mkdir -p /home/testuser/backup/'" line:13)

I can properly pass the argument to exec if I set the command in a list or quote it like so:

exec ssh "testuser@ -q 'mkdir -p /home/testuser/backup/'"

But then I run into the fingerprint issues:

The authenticity of host ' -q '/bin/mkdir -p /home/testuser/backup/' (' can't be established.
RSA key fingerprint is 8f:cf:e4:d8:f2:ad:2e:c7:8b:f8:xxxxxxxx.
Are you sure you want to continue connecting (yes/no)? 

Anyways, I eventually got it working with the following:

set ssh_options "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -q"
set ssh_cmd "/bin/mkdir -p /home/testuser/backup/"
eval exec ssh $ssh_options testuser@ $ssh_cmd

It was erroring out still when I tried to use the {*} expansion instead of using "eval".

Hope that helps someone.