LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 06-20-2021, 09:30 PM   #1
dellthinker
Member
 
Registered: Jan 2007
Distribution: Debian
Posts: 220

Rep: Reputation: 30
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.
 
Old 06-20-2021, 09:55 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,358
Blog Entries: 28

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

Just my two cents.
 
Old 06-20-2021, 11:56 PM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,967

Rep: Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333
Quote:
Originally Posted by dellthinker View Post
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?
 
Old 06-20-2021, 11:57 PM   #4
dellthinker
Member
 
Registered: Jan 2007
Distribution: Debian
Posts: 220

Original Poster
Rep: Reputation: 30
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
 
Old 06-21-2021, 12:02 AM   #5
dellthinker
Member
 
Registered: Jan 2007
Distribution: Debian
Posts: 220

Original Poster
Rep: Reputation: 30
Cool

Quote:
Originally Posted by pan64 View Post
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
 
Old 06-21-2021, 12:09 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by dellthinker View Post
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.
 
Old 06-21-2021, 12:37 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,967

Rep: Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333
Quote:
Originally Posted by dellthinker View Post
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).
 
Old 07-03-2021, 05:41 PM   #8
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by dellthinker View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding an computer Artificial Intelligence using BASH? patrick295767 Programming 8 09-22-2012 02:49 PM
Bash awk coding loop rafir Linux - Newbie 12 04-12-2012 03:18 AM
ease bash/sh coding: Has someone right(,), left(,), and len(,) scripts for /usr/bin ? frenchn00b Programming 12 04-23-2009 02:33 PM
bash coding stocky021 Programming 3 11-01-2007 07:44 AM
Bash Coding Help neoific Linux - Software 1 11-11-2004 07:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 10:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration