iocage exec error when using echo

PeterSM

Dabbler
Joined
Dec 21, 2014
Messages
30
I am trying to update my jails to 11.3-RELEASE by recreating them and I have run into an issue.
The command:
1576062818937.png

returns the error :
unmatched '''
I know I can do this from withtin the jail but I am wondering what is wrong with this?

This is on FreeNAS11.2-U7
 

Attachments

  • 1576062750031.png
    1576062750031.png
    9.9 KB · Views: 278
  • 1576062773240.png
    1576062773240.png
    9.9 KB · Views: 284

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
If you're wanting to do it by way of iocage exec, I'd probably do iocage exec jailname sh -c (the rest of the command--why did you paste it in as an image?). That's the only way I've been able to get the output redirection to work.

But what does your question have to do with your thread title?
 

PeterSM

Dabbler
Joined
Dec 21, 2014
Messages
30
Thanks Dan
Thread title changed. I must have pasted by mistake! As to the image that is just how it worked apologies.
Now within code tags
Code:
iocage exec <jail> "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"


I have tried this:
Code:
iocage exec <jail> sh -c  ("echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf")


but get the same unmatched ' ' ' error

Any sugestions?
 

Attachments

  • 1576078445221.png
    1576078445221.png
    10.4 KB · Views: 259
  • 1576078479616.png
    1576078479616.png
    10.4 KB · Views: 266
Last edited:

colmconn

Contributor
Joined
Jul 28, 2015
Messages
174
You could also do it, for example, like this:
Code:
iocage exec ${JAIL_NAME} -- mkdir -p /usr/local/etc/pkg/repos/
iocage exec ${JAIL_NAME} -- "cat /etc/pkg/FreeBSD.conf | sed 's,quarterly,latest,' > /usr/local/etc/pkg/repos/FreeBSD.conf"


I've also had luck getting the following redirection to work:
Code:
cat <<EOF | iocage exec ${JAIL_NAME} -- "cat - > /tmp/build-mono.sh"
/bin/sh

set -x
# do stuff here
EOF
iocage exec ${JAIL_NAME} -- "chmod +x /tmp/build-mono.sh"
iocage exec ${JAIL_NAME} -- "/tmp/build-mono.sh"
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
but get the same unmatched ' ' ' error
That looks like there's an unescaped character somewhere breaking the string... you may need to escape the curly braces or colons... not sure.
 

anmnz

Patron
Joined
Feb 17, 2018
Messages
286
but get the same unmatched ' ' ' error

Any sugestions?
You are running the command in csh. I would use /bin/sh instead. Your command appears to work fine there. (For interactive use just type sh and away you go.)

BTW I strongly recommend @colmconn's suggested approach, where you construct commands/data and pipe them into iocage exec, rather than putting them on the iocage exec command line where they may need complex escaping.
 
Top