With using terminal for a long time, PATH variable tends to be longer and longer due to duplicated path.
Here is simple sample script - with Perl - to resolve this.
# remove duplication at give PATH-format-string unique_path() { perl -w -e ' my %path_hash; exit unless (defined $ARGV[0]); foreach $p (split (/\:/, $ARGV[0])) { unless (defined $path_hash{$p}) { $path_hash{$p} = 1; push @newpath, $p; } } print join ":", @newpath; ' $1 } ...(skip)... PATH=$(unique_path "$PATH") ...(skip)
Done :-).
'Domain > Linux' 카테고리의 다른 글
atime 대신에 strictatime을 사용하자! (0) | 2013.05.31 |
---|---|
[Shell] Variable Name Expansion (0) | 2013.03.28 |
[Ubuntu] C-s and C-q doesn't work in gnorm-terminal (0) | 2011.03.18 |
[Ubuntu] visual effect doens't work with Nvidia driver... (0) | 2011.01.19 |
[Linux] Writing input event directly. (0) | 2010.11.29 |