Skip to content

Instantly share code, notes, and snippets.

@Kaabi
Kaabi / add-new-lang-string.sh
Last active May 5, 2020 11:44
Inserting New Language variable name & value into Codeigniter multiple languages folders
#!/bin/sh
[ -z $1 ] && echo "Language file name is missing" && exit 1
[ -z $2 ] && echo "Language variable name is missing" && exit 1
[ -z "$3" ] && echo "Language variable value is missing" && exit 1
for i in $(find . -maxdepth 1 -mindepth 1 -type d); do
if ! [ -z "$(tail -c 1 "$i/$1_lang.php")" ]; then
echo "\n" >>$i/$1_lang.php
fi
echo "\$lang['"$2"'] = '"$3"';" >>$i/$1_lang.php