Date: Fri, 12 Jul 2013 11:34:52 +1000 From: Colin House <colin@restecp.com> To: Fbsd8 <fbsd8@a1poweruser.com> Cc: questions@FreeBSD.org Subject: Re: jls usage Message-ID: <51DF5D3C.9050007@restecp.com> In-Reply-To: <51DF59B1.4020107@a1poweruser.com> References: <51DF59B1.4020107@a1poweruser.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 12/07/2013 11:19 AM, Fbsd8 wrote:
> In a .sh script I'm trying to get the jid for a single jail using this code
>
> jid=`jls -j jailname | cut -f 1- | awk '{print $1}'`
>
> The first line output by jls is a title line which the cut command is
> suppose to cut out so the first field on line 2 gets selected by the awk
> command. This is not working as I want, I get the first field of the
> title line.
>
> Is the cut command the correct command to us here?
>
> This is what the jls command shows
> # /root >jls -j dir2
> JID IP Address Hostname Path
> 15 10.0.10.24 dir2 /usr/jails/dir2
>
> I am after the number 15
>
> Thanks in advance
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"
this might do the trick for you:
jls -j jailname | tail -1 | awk '{print $1}'
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51DF5D3C.9050007>
