I try to create a one-liner in Bash for the command below. If I can call just this one-liner as sh in the bash script it is also good.
It looks like that it is in sh.
The command below creates a file in profile.d and adds the view lines as a function.
With everything I tried I get syntax errors.
I not need it exactly as is. I want to have it in one line. And call it in a bash script, if the instructions are in sh, this needs to be taken in consideration.
I am writing a bash script to automate the config after a new installation. For the moment just for the Gnome Desktop.
Now it works as it should. The example below shows why I liked a one liner.
It’s an interesting take on the problem. “The problem” being what to do on a new system and how to do it. It goes like this:
You have this script that you get onto the new host somehow.
Then you run it.
Time passes and you tweak your script. Now your script and prior hosts are out of sync.
Goto step #1 × however many hosts you’re maintaining.
Alternatively, you can have your initial setup script configure a dedicated Ansible user with a public key and password-less sudo. Then manage all the other configuration on your entire fleet through Ansible. Tweak a config? Run your Ansible playbook(s) once targeting your entire host inventory, and all your hosts are synced up again. Each Ansible task could be one of your one-liners, and you could add other more canonical Ansible tasks as well.
But what you have is an excellent start! It’s amazing how many little tweaks creep in, and how quickly config drift across hosts starts to impact getting things done. What you’re doing with this script is so much better than trying to update these things manually, especially once multiple hosts are involved.
However, I think your one-liner pattern is already causing readability and maintainability issues. Compare for example this:
I was looking into Ansible once, however to keep up with that, for that what I need it for, is to much. So a bash script for my use case is more as enough.
I will have a look to the pull request when I do have a bit more time.
Thanks so far.