[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]![]() |
![]() |
![]() |
|||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
![]() |
![]() |
![]() |
while read i; do if [[ "$i" == wan* ]]; then echo $i ssh localhost pwd fi done <"ip.txt"
Hvad vil du gerne have scriptet til at gøre ?
ssh localhost pwd kan man ikke bare skrive, da ssh skal password fra consolen og ikke som parameter.
Hvis man har sat ssh op til ikke at bruge passwords er der vel ikke noget problem?
ssh localhost pwd
betyder jo ssh til ens egen maskine og udfør kommandoen pwd, print working directory.
Det, der er problemet i scriptet er, at når ssh bliver kaldt er stdin stadigvæk redirected til ip.txt, og ssh vil så æde resten af filen.
Man skal skrive:
ssh -n localhost pwd
så overtager ssh ikke stdin.
Mogens
-- Mogens Kjaer, Carlsberg A/S, Computer Department Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark Phone: +45 33 27 53 25, Fax: +45 33 27 47 08 Email: sslug@sslug Homepage: http://www.crc.dk
![]() |
![]() |
![]() |
||||||||||||
|
||||||||||||||
![]() | ||||||||||||||
|
||||||||||||||
![]() |
![]() |
![]() |