[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Bash, while read uventet opf ørsel



Peter Makholm skrev:

sslug@sslug (Gorm Rasmussen) writes:

while read i; do
 if [[ "$i" == wan* ]]; then  echo $i
   ssh localhost pwd
 fi
done <"ip.txt"

Hvis jeg udkommenterer linien med ssh udskrives alle linier startende
med wan, men med ssh-linien stopper loopen efter 1. iteration. Er der
en som kan fortælle mig hvad retning jeg skal kigge i.

Det der sker er at ssh læser fra stdin, sikkert for at sende det
videre til pwd på localhost. Jeg kan ikke lige på stående fod afgøre
om det er en bug eller feature.

Men hvis du skriver:

  while read i; do
    if [[ "$i" == wan* ]]; then  echo $i
      ssh -n localhost pwd
    fi
  done <"ip.txt"

burde det virke.

//Peter Makholm

Tak for hjælpen. Endnu engang må jeg hellere komme igang med studierne. Ovenstående virker fuldstændig efter hensigten.


Gorm




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-11-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *