linux echo extra slash -
i creating script go into particular column , row in csv file , use data part of file subdirectory. so, have directory = $d , sub-directory = $s
my scripts works well, not important part. when try output information in script like..
echo "file $d/$s unable replicated" i output on screen...
file /home/jsigel//filename unable replicated what need rid of slash? i've tried thousand things , nothing seems work.
the slash harmless, can remove output if with
echo "file ${d%/}/$s unable replicated" if $d have trailing slash, removed , explicit / output in place. if $d not have trailing slash, no change made, , again explicit / output.
Comments
Post a Comment