[SOLVED] Basic question about grep
by mackowiakp from LinuxQuestions.org on (#6PCAA)
Just a small rest program in shell:
Code:#!/bin/sh
cd /dev/shm
wyn=`/sbin/route |grep "192.168.0.0"`
echo $wynreturns strange result:
Code:192.168.0.0 ampli_mode err_number nazwa_stacji nazwa_stacji_lcd nr_stacji pipe pipe_ssh radio route sem_ampli sem.MYAPPL sem.MYDBJOB sem.MYIDBS sem.MYIDBSSTOP sem.MYINOTIFY sem_off sem_tv storage_usage_history url_stacji wget 255.255.255.0 U 0 0 0 qvs0That is result of grep and content current directory
When I run directly from CLI it return correct result
Code:# /sbin/route |grep "192.168.0.0"
192.168.0.0 * 255.255.255.0 U 0 0 0 qvs0There is asterix in result but I dont understand why it returns different results
Any idea?
Code:#!/bin/sh
cd /dev/shm
wyn=`/sbin/route |grep "192.168.0.0"`
echo $wynreturns strange result:
Code:192.168.0.0 ampli_mode err_number nazwa_stacji nazwa_stacji_lcd nr_stacji pipe pipe_ssh radio route sem_ampli sem.MYAPPL sem.MYDBJOB sem.MYIDBS sem.MYIDBSSTOP sem.MYINOTIFY sem_off sem_tv storage_usage_history url_stacji wget 255.255.255.0 U 0 0 0 qvs0That is result of grep and content current directory
When I run directly from CLI it return correct result
Code:# /sbin/route |grep "192.168.0.0"
192.168.0.0 * 255.255.255.0 U 0 0 0 qvs0There is asterix in result but I dont understand why it returns different results
Any idea?