Skip to content

Tag: bash

BASH: echo -e does not work with Unicode Cyrillic

I recently switched to another working machive and faced a problem when I work with Cyrillic. My Bash script gets new messages from an application and works with them. However the messages are mostly written in Cyrillic and I get results like “u043fu0440u0438u0432u0456u0442” On my old system that …

Why is /etc/profile.d only used at SSH login?

The use of /etc/profile.d is confusing to me. I can put a file in there for example with contents and when I logon the the machine using SSH MYVAR has a value. This machine is a Ubuntu desktop, when I logon using ordinary login and start a terminal MYVAR has no value. I don’t understand why this should …

Modify config files with sed in bash

I am trying to set net.ipv4.ip_forward to 1 in /etc/sysctl.conf.The following works fine but it sure missing some edge cases For e.g if the sysctl.conf contain any one of the following it won’t match #net.ipv4.ip_forward=1 ##net.ipv4.ip_forward=1. Is there a more reliable way to modify settings in confi…

Ubuntu bash script grepping and cutting on first column

I am trying to implement a bash script that will take the piped input and cut the first column and return a total. The difference is that the cut is not from a file, but from the piped input. For example: Basically, in my scenario the first column will always be from the passed input. Example usuage is: data.…