I'm trying to get better at one-liners here, this is what I have currently.
$ echo $PATH
/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
What I want to do is strip off that first chunk, so here's what I've figured out so far ---
$ echo $PATH | sed -e "s|^/[A-Za-z/]*:||"
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
The last thing I want to do here is to put that back into PATH, like export PATH=[that result]
The way I've tried this was as follows, which I can't get to work ---
$ echo $PATH | sed -e "s|^/[A-Za-z/]*:||" | xargs export PATH=
xargs: export: No such file or directory
Also, BTW, separate issue that confused me was with the sed expression above, for some reason when I tried using + rather than *, it wouldn't catch the first bit. Look ---
$ echo $PATH | sed -e "s|^/[A-Za-z/]+:||"
/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Its like the +, meaning "one or more" doesn't work as well as the "many" *.
read PATH
-- but that's not what's needed here at all. – Townscape