LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-19-2015, 04:40 PM   #1
curtvaughan
Member
 
Registered: Nov 2014
Location: Austin, TX
Distribution: Mint, Debian, and Mageia; Manjaro; vboxes of varying flavors
Posts: 37

Rep: Reputation: Disabled
recursive xterms via .bashrc


I made the mistake of adding an xterm invocation to my ".bashrc" file. My intent was to simply execute an xterm upon initial login to the KDE environment on Debian Wheezy (though the distro probably would have made no difference). What happened is that with each invocation of "xterm", the new xterm would again invoke an "xterm" via the ".bashrc" file. Duh, infinite recursion of xterms upon login. Is there a simple way to invoke an xterm at login that doesn't itself lookup the ".bashrc" file? By the time someone answers this, I will probably find and answer somewhere in the bash/xterm man pages, but thought I'd throw it out there. Really felt stupid after having realized my mistake. Had to login to recovery command line mode and replace the ".bashrc" file with "/etc/skel/.bashrc". Cheerio
 
Old 03-19-2015, 04:49 PM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
yes, you may check the value of $SHLVL for example (or you can check if it was a login shell). But usually it is not a good idea (to start xterm in .bashrc). I think you can have a start menu or similar to configure such things
 
1 members found this post helpful.
Old 03-19-2015, 04:52 PM   #3
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
Put xterm in the autostart folder?

jlinkels
 
1 members found this post helpful.
Old 03-19-2015, 05:01 PM   #4
curtvaughan
Member
 
Registered: Nov 2014
Location: Austin, TX
Distribution: Mint, Debian, and Mageia; Manjaro; vboxes of varying flavors
Posts: 37

Original Poster
Rep: Reputation: Disabled
recursive xterms via .bashrc [SOLVED]

Thank you both for your replies. Will look into both of your suggestions. Scripting action based on shell level is intriguing, but I agree that editing bash initialization script is a bad idea for this kind of thing. I will definitely explore alternate startup possibilities.
 
Old 03-19-2015, 07:16 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
The SHLVL is not reliable. It works as long as there is nothing that overwrites it or deletes the definition (such as "unset SHLVL")- in which case, the count starts over...

But for this purpose it should work relatively well.

BTW, if you are in a GUI, you always get SHLVL to be "2", as the first level is in use starting up the GUI (even if it does do an "exec" at the end to start the GUI manager).
 
1 members found this post helpful.
Old 03-20-2015, 02:15 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
you can also check xinit and xsession (see man pages) about that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] /etc/bashrc ,dircolors and /root/.bash_profile ,/.bashrc not exist in LFS-7.5(sec9.3) jaassi Linux From Scratch 2 09-20-2014 06:04 PM
xterms wrap over the same line when typing! humbletech99 Linux - Software 6 12-30-2005 06:58 PM
save position & desktop of multiple xterms in Fluxbox esteeven Linux - General 7 05-12-2005 03:50 PM
Opening xterms from a script Nice-n-Slow DamnSmallLinux 2 08-15-2004 05:25 AM
creating xterms/consoles set in the background? tommyj27 Linux - Software 8 01-14-2004 12:10 PM


All times are GMT -5. The time now is 08:38 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration