jls usage

Fbsd8 fbsd8 at a1poweruser.com
Fri Jul 12 01:19:47 UTC 2013


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



More information about the freebsd-questions mailing list