shell

convert symlinks to regular files

As you might need to convert a lot of symlinks to regular files (e.g. for windows compatibility reasons) you could use the following line to remove theme.
warning: This command deletes all symlinks infront to allow cp to copy them correctly to the target directory.


for f in `find . -type l`; do (cd `dirname $f`; target=`basename $f`; source=`readlink $target` ; rm -rf $target && cp -r $source $target || pwd); done

if you only linked files directly (without any directories) there are more elegant ways, but this works in every case.

usecase:

java propeties file translation for bash/ shell

if you want to use localisation in a bash script, using standard java property files is a good way.

if you use this syntax:


cat `dirname $0`/web/src/messages_de_DE.properties | sed '/^.$/d' |sed 's/[\.|-]/_/g' | sed 's/|//g' | sed 's/\ = /=/g' | sed 's/\=/="/g' | sed 's/.$/"/g' | sed '/^ *$/d' > .properties.file

you get a converted version of the propertyfile which can be included inside the bashscript.

my.example.translation = "word"

will be converted to

my_example_translation

and can be used inside the script with $my_example_translation

Inhalt abgleichen