Hello, On Sat, 22 Aug 2020, jdd@dodin.org wrote:
Le 21/08/2020 à 23:47, David C. Rankin a écrit :
On 8/21/20 1:58 AM, jdd@dodin.org wrote:
#!/bin/sh for i ; do j=$(readlink $i) ; k=sed -i 's///run/media/jdd/intenso5to2/../..//g' $j ; ln -sf $k $i ; done [..] if you can find why the above script don't works, it will be ok for me,
You need to either escape the '/' not used as sed's s/// command-delimiters or use other delimiters. And of course you need to use a command-substitution just as you did for the j=. Also, you should always quote your variables on acces. I.e. either for i ; do j="$(readlink "$i")"; k="$(sed -i 's/\/\/run\/media\/jdd\/intenso5to2/..\/..\//g' "$j")"; ln -sf "$k" "$i"; done or for i ; do j="$(readlink "$i")"; k="$(sed -i 's@//run/media/jdd/intenso5to2@../../@g' "$j")"; ln -sf "$k" "$i"; done Or even better, replace the sed with a bash-substitution: for link ; do target="$(readlink "$link")"; ln -sf "${target/\/\/run\/media\/jdd\/intenso5to2/..\/..\/}" "$link"; done HTH, -dnh -- panic("Oh boy, that early out of memory?"); linux-2.2.16/arch/mips/mm/init.c -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org