Janus Ng
Explorer
- Joined
- Apr 10, 2016
- Messages
- 63
I have just installed FreeNAS for a week. There were 2 updates after my initial installation. I appreciate it quick development very much. Thanks developers!
As I have many files with names in many languages, I prefer to set the locale in bash to utf-8. This feature is useful to all users; hence, I change the /etc/login.conf, add a line ":lang=en_US.UTF-8:\" to default setting such as:
However, I found that the file is rest every time the OS is updated. That's why I wrote a shell script to accomplish the task. I can run it just after an update next time. The script is listed as following.
However, it reports the following error.
Please help me out! Thanks a ton!
As I have many files with names in many languages, I prefer to set the locale in bash to utf-8. This feature is useful to all users; hence, I change the /etc/login.conf, add a line ":lang=en_US.UTF-8:\" to default setting such as:
default:\
becomes:passwd_format=sha512:\
...
...
default:\
:lang=en_US.UTF-8:\
:passwd_format=sha512:\
...
:passwd_format=sha512:\
...
However, I found that the file is rest every time the OS is updated. That's why I wrote a shell script to accomplish the task. I can run it just after an update next time. The script is listed as following.
#!/bin/bash
d=$(date +%Y-%m-%d)
f=/etc/login.conf
i=0
n=$f.$d.$i
while [ -a "$n" ]; do
i=$(($i + 1))
n=$f.$d.$i
done
sed -i .$d.$i -E 's/^default:\\$/&\'$'\n'$'\t:lang=en_US.UTF-8:\\/g' $f
echo
echo $f backed up to $n
echo $f is updated with en_US.UTF-8 locale.
cap_mkdb /etc/login.conf
echo
echo Please relogin to use new settings.
d=$(date +%Y-%m-%d)
f=/etc/login.conf
i=0
n=$f.$d.$i
while [ -a "$n" ]; do
i=$(($i + 1))
n=$f.$d.$i
done
sed -i .$d.$i -E 's/^default:\\$/&\'$'\n'$'\t:lang=en_US.UTF-8:\\/g' $f
echo
echo $f backed up to $n
echo $f is updated with en_US.UTF-8 locale.
cap_mkdb /etc/login.conf
echo
echo Please relogin to use new settings.
However, it reports the following error.
sed: 2: "s/^default:\\$/&\
:lan ...": unterminated substitute in regular expression
sed complaint about the backslashes in the substitute text.:lan ...": unterminated substitute in regular expression
Please help me out! Thanks a ton!
Last edited: