PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Bash Skript Problem



aeuglein
16.08.05, 23:37
Hi,

Warum wird $ip nicht mit dem vorher zugewiesenen Wert ersetzt?



#!/bin/bash
ip=$(curl -s http://checkip.dyndns.org | grep -o [0-9.]*[0-9.])
curl -s http://www.staticcling.org/update.html?login=xxxpass=xxxx&ip=$ip

drcux
16.08.05, 23:59
ip=`curl -s http://checkip.dyndns.org | grep -o [0-9.]*[0-9.]`

aeuglein
17.08.05, 00:01
ip=`curl -s http://checkip.dyndns.org | grep -o [0-9.]*[0-9.]`

Das ist das gleiche in grün.
Es geht immer noch nicht.

drcux
17.08.05, 00:12
Hier geht es wunderbar...

pc:~> ip=`curl -s http://checkip.dyndns.org | grep -o [0-9.]*[0-9.]`
pc:~> echo $ip
84.128.161.103

aeuglein
17.08.05, 00:19
Hier geht es wunderbar...

pc:~> ip=`curl -s http://checkip.dyndns.org | grep -o [0-9.]*[0-9.]`
pc:~> echo $ip
84.128.161.103

bei mir ja auch... aber er stopft den Wert der Variable nicht in den Befehl


curl -s http://www.staticcling.org/update.html?login=xxx/pass=xxxx&ip=$ip

rein!

aeuglein
17.08.05, 11:07
Hat den keiner eine Idee?

drcux
17.08.05, 11:25
curl -s "http://www.staticcling.org/update.html?login=xxxpass=xxxx&ip=$ip"

ansonsten wird wohl das & von der Bash als Sonderzeichen gewertet...

aeuglein
17.08.05, 11:32
Jo, Klasse! Danke dir!