Welcome to the Linux Foundation Forum!

Using cut command as part of another command

I'm looking to open my Jellyfin server dashboard on my browser (I use Helium). I have the issue that when I restart my computer my local IP changes so just linking to http://192.168.0.111:8096/web/#/home doesn't work as after a restart the link might need to be http://192.168.0.222:8096/web/#/home or another ip.
I can get the IP using ip addr show eno1 then add :8096/web/#/home but that seems clunky.
I can output ip addr show eno1 to a file like:

ip addr show eno1 > eno1.tmp grep "inet " eno1.tmp > output.tmp cut -c 10-22 output.tmp > ip.tmp

but I'd like to feed the contents of ip.tmp (the local ip) into helium http://xxx.xxx.x.xxx:8096/web/#/home and I've no idea how to stick that in a desktop file and shout ta daa.

Any ideas

Answers

  • I had a stroke of inspiration and produced:

    ip addr show eno1 > eno1.tmp && grep "inet " eno1.tmp > output.tmp && eval "helium http://"$(cut -c 10-22 output.tmp)":8096/web/#/home" && rm output.tmp && rm eno1.tmp

    I presume it could definitely be improved, but I'm sure I could slap that in a desktop file.

    Please feel free to improve it; I'm here to learn.

Categories

Upcoming Training