← Back to team overview

sslug-teknik team mailing list archive

Re: ifconfig & grep

 

Torbjörn Lundahl wrote:

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

Hi,

Try
eval $getip

Hans Christian




Follow ups

References