I want to ask how to remove path in cygwin. Let's say I have 3 paths:
PATH=path1:path2:path3
I want to remove path2 so it will be:
PATH=path1:path3
But actually i have a lot of path inside and it will painful to rewrite it manually. Any suggestion?
A simple solution is to use the bash or csh command-line:
export PATH=`echo $PATH | sed s/:path2//`
But this will only work 99.9% of the time. To handle the edge cases, such as when path2 is at the start, or when it is part of another path, you'll need:
export PATH=`echo $PATH | sed "s/:path2:/:/g;s/^path2://;s/:path2$//"`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With