Re: tcpdump + IFS = no sense?



I'm setting it to a carriage return:

IFS="
"

As I've done a million times before. The result is the ability to read
a text file one line at a time rather than one word at a time. That
functionality still works fine, it's just that tcpdump is choking.

Dale Dellutri wrote:
On 29 Aug 2006 08:49:46 -0700, tony.andreoli@xxxxxxxxx wrote:
Ok, perhaps one of the experts here can help. I'm just trying to write
a small script that will start a tcpdump. The dump will be started
with a variable for tcpdump's parameters. This works fine:

cmd="-i eth0"
tcpdump $cmd

BUT, if I then add an IFS command before it (to eventually allow me to
read the parameters from a config file) it doesn't work. This fails:

IFS="
"
cmd="-i eth0"
tcpdump $cmd

with a "tcpdump: ioctl: No such device"
I've tried it with Redhat EL3 and FC5 with the same results. Can
someone explain what the heck's going on?

bash can't parse the command string properly because you changed the
field separator. What are you setting IFS to?

$IFS
internal field separator
This variable determines how Bash recognizes fields, or word
boundaries when it interprets character strings.
$IFS defaults to whitespace (space, tab, and newline), but may be
changed, for example, to parse a comma-separated data file. Note that
$* uses the first character held in $IFS. See Example 5-1.

--
Dale Dellutri <ddelQQQlutr@xxxxxxxxxxxx> (lose the Q's)

.



Relevant Pages

  • Re: tcpdump + IFS = no sense?
    ... a small script that will start a tcpdump. ... tcpdump $cmd ... What are you setting IFS to? ... internal field separator ...
    (comp.os.linux.networking)
  • Re: Read command and trailing spaces
    ... On Thu, 09 Oct 2003 at 11:19 GMT, William Park wrote: ... >> Set the field separator, $IFS, to an empty string, so that read ...
    (comp.unix.shell)
  • How to modify IFS?
    ... Do you know why I cannot just use normal assignment to change the content of variable IFS (which supposedly change the shell's field separator)? ... [arifsaha@iMac2006 arifsaha]$ set | egrep IFS ...
    (comp.unix.shell)
  • What does IFS="${IFS}[]()" mean?
    ... I have a ksh script as below. ... I know IFS is for Field Separator; ...
    (comp.unix.shell)