Re: Set ip lan address /etc/environment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



2018-05-30 18:34 GMT+02:00 Leonid Isaev via arch-general
<arch-general@xxxxxxxxxxxxx>:
> On Wed, May 30, 2018 at 01:07:59PM +0200, Maykel Franco via arch-general wrote:
>> Hi, I put this text in /etc/environment:
>>
>> $ source /etc/environment
>>
>> ip="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d
>> ' ' -f 1)"
>>
>> $ echo $ip
>>
>> 192.168.0.33
>>
>> Works fine, but when I reboot my archlinux:
>>
>> $ echo $ip
>>
>> $(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)
>>
>>
>> What's happened?? Is necessary exec source /etc/environment after every reboot?
>>
>> Thanks in advanced.
>
> /etc/environment is for PAM not shell, so it only allows ip=xxx.yyy.zzz.aaa .
> Also, /etc/profile is for LOGIN shells, meaning that from scripts or when doing
> scp(1) it won't be read. What exactly are you trying to achieve?
>
> Cheers,
> --
> Leonid Isaev

I need define variable called ip with current ip address machine...

And when reboot machine, the variable ip always has ip address.



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux