Skip to content
Snippets Groups Projects
Commit dd47862a authored by Boman Romain's avatar Boman Romain
Browse files

loop over vars

parent a1b0dae3
No related branches found
No related tags found
No related merge requests found
......@@ -11,5 +11,12 @@ fi
# remove duplicate entries in LD_LIBRARY_PATH
# see https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
LD_LIBRARY_PATH=$(printf %s "$LD_LIBRARY_PATH" | awk -v RS=: '{ if (!arr[$0]++) {printf("%s%s",!ln++?"":":",$0)}}')
# -version initiale
#LD_LIBRARY_PATH=$(printf %s "$LD_LIBRARY_PATH" | awk -v RS=: '{ if (!arr[$0]++) {printf("%s%s",!ln++?"":":",$0)}}')
# -version "boucle"
for var in PATH LD_LIBRARY_PATH
do
cmd="$var=\$(printf %s \"\$$var\" | awk -v RS=: '{ if (!arr[\$0]++) {printf(\"%s%s\",!ln++?\"\":\":\",\$0)}}')"
eval $(echo $cmd)
done
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment