help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] set and IFS


From: Gérard ROBIN
Subject: [Help-bash] set and IFS
Date: Tue, 20 Nov 2018 11:51:07 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Hello,
I encounter a problem when I modify IFS with this file:

cat nomutilsuid.sh

#!/bin/bash

while read nom reste
do
        svIFS=$IFS
        IFS=:
         set $nom
         IFS=$svIFS
         echo $1 $4
done < modfile

cat modfile

g:gg:ggg:1:bin
q:qq:qqq:2:bin
f:ff:fff:3:bin
k:*:kkk:4:bin

the output of ./nomutilsuid.sh

g 1
q 2
f 3
k danbin.sh

where danbin.sh is the third file of the current directory instead of 4.

The issue rises with the file /etc/passwd
How can we solve the problem ?

tia.

-- 
Gerard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]