LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Bash coding (https://www.linuxquestions.org/questions/linux-desktop-74/bash-coding-4175696707/)

dellthinker 06-20-2021 09:30 PM

Bash coding
 
I'd like to write a shell code that will put back the settings I make in the terminal,
i'm open to learning php except the settings i make will be for certain distributions say Debian or Gentoo, so i was considering bash coding but open to either. Would like any suggestions on which I should choose please.

Thank you.

frankbell 06-20-2021 09:55 PM

If you are writing this to manage BASH terminals, I suspect a BASH script would be the better option.

Just my two cents.

pan64 06-20-2021 11:56 PM

Quote:

Originally Posted by dellthinker (Post 6260607)
I'd like to write a shell code that will put back the settings I make in the terminal,

It is unclear for me. What kind of settings is it? Do you have an example? (or even better) do you have a sample code?

dellthinker 06-20-2021 11:57 PM

Yes this too I suspected. I'm looking for a easier way to restore all my personal settings when i re-install a OS. Thanks for the help

dellthinker 06-21-2021 12:02 AM

Quote:

Originally Posted by pan64 (Post 6260619)
It is unclear for me. What kind of settings is it? Do you have an example? (or even better) do you have a sample code?

Oh for example, some commands like shutdown isn't in the /root path so I would have to type it like /sbin/shutdown -r . That and a whole lot of other commands are default in another path, so I was weighing on whether or not I would learn php or bash scripting to customize the cmd line the way I want it. If that makes any sense

ondoho 06-21-2021 12:09 AM

Quote:

Originally Posted by dellthinker (Post 6260622)
Oh for example, some commands like shutdown isn't in the /root path so I would have to type it like /sbin/shutdown -r . That and a whole lot of other commands are default in another path, so I was weighing on whether or not I would learn php or bash scripting to customize the cmd line the way I want it. If that makes any sense

It makes very little sense and is still way too broad, but youprobably want to learn bash (and not php) if your shell is using bash.

Issue
Code:

echo $SHELL; echo $0
to find out.

pan64 06-21-2021 12:37 AM

Quote:

Originally Posted by dellthinker (Post 6260621)
Yes this too I suspected. I'm looking for a easier way to restore all my personal settings when i re-install a OS. Thanks for the help

That would be a backup solution, so you save all of your personal settings, files before reinstall and try to restore it afterward.
From the other hand you may have a data (user) partition which will not be modified/altered during that OS reinstall, therefore there is no need to restore it (anyway, a backup would be helpful).

Skaperen 07-03-2021 05:41 PM

Quote:

Originally Posted by dellthinker (Post 6260607)
I'd like to write a shell code that will put back the settings I make in the terminal,
i'm open to learning php except the settings i make will be for certain distributions say Debian or Gentoo, so i was considering bash coding but open to either. Would like any suggestions on which I should choose please.

Thank you.

create a list of all the files you change for the settings you change. if you installed a new system on 2021-05-31 and changed many settings through the month of June, then scan for all system files changed in the month of June. that's a good starting list. edit it and remove file names that are not your settings. make a backup of the files named by what remains. make a 2nd backup. test your backup to be sure you can read it and get the files back out. test the 2nd backup, too.


All times are GMT -5. The time now is 09:26 AM.