LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-11-2006, 03:46 PM   #1
DoDo1975
LQ Newbie
 
Registered: Nov 2006
Posts: 17

Rep: Reputation: 0
howto spawn shell when env variable doesn't point to /bin/sh


Hi,

I have my environment (ENV) variable set to a shell script that used dialog and ncurses to display a graphical menu. One of the options of the menu is to spawn a shell.

When this option is chosen, the shell immediately spawns but then runs my menu again.

Is there a way I can spawn just a shell, and not run the environment variable everytime or some other way of achieving this?
 
Old 12-11-2006, 05:10 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
How are you spawning?
What happens if you explictly spawn /bin/bash ?
 
Old 12-11-2006, 05:30 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Add a check in your shellscript to check current SHLVL and don't spawn the menu if SHLVL=$[${SHLVL}+1] ?
 
Old 12-11-2006, 05:37 PM   #4
budword
Member
 
Registered: Apr 2003
Location: Wisconsin
Distribution: Switched to regualr Ubuntu, because I don't like KDE4, at all. Looks like vista on crack.....
Posts: 675

Rep: Reputation: 31
Edited my post, as I didn't understand your question the first time around.

Sorry bout that.

Last edited by budword; 12-11-2006 at 05:40 PM.
 
Old 12-11-2006, 05:58 PM   #5
DoDo1975
LQ Newbie
 
Registered: Nov 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Hi,

If I explicitly call /bin/sh or /bin/ash (I am not using bash), then I can see a shell spawned for a split second, but then my menu returns.
 
Old 12-11-2006, 06:09 PM   #6
DoDo1975
LQ Newbie
 
Registered: Nov 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Unspawn,

You had a great idea. I just realised though that ash doesn't support this environment variable. I am attempting to see if I can remedy that or maybe somehow create my own variable. I guess I could just set a variable in the profile before the env setting and check if its set before setting the env to the menu. I will try that.

If anyone else has any ideas, please let me know!

Joel
 
Old 12-11-2006, 07:34 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I guess I could just set a variable in the profile before the env setting and check if its set before setting the env to the menu.
Clean solution. Exporting once should prolly do. Inheritance and all that.
 
  


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
socks proxy - env variable andrewlkho Linux - Networking 1 06-23-2013 09:58 PM
hosts.allow spawn /bin/mail zzyzx Slackware 8 08-23-2005 11:24 AM
/tools/bin/env: /tools/bin/bash: No such file or directory DaZjorz Linux From Scratch 21 07-27-2005 07:11 AM
env variable allelopath Linux - Software 3 04-14-2005 12:07 PM
Changing $PATH env variable alzogbi Linux - Newbie 2 03-26-2004 02:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:34 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