← Back to team overview

sslug-teknik team mailing list archive

ifconfig & grep

 

Hello!
 
I have a problem with the script “test”, this work in command line:
ifconfig | grep -A 1 eth0 | grep inet | cut -d : -f 2 | cut -d " " -f 1
 
This doesn’t work:
#!/bin/bash
# -rwxr-xr-x    1 root     root           99 maj 15 21:14 test*
getip='ifconfig | grep -A 1 eth0 | grep inet | cut -d : -f 2 | cut -d "
" -f 1'
$getip
 
 
This work:
#!/bin/bash
# -rwxr-xr-x    1 root     root          106 maj 15 21:18 test1*
getip='ifconfig eth0'
$getip
 
Mvh
Torbjörn
 

Follow ups