LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-20-2006, 09:34 PM   #1
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Question restart the shell from within a shell script


hi, i'm building linux from scratch, and i have a small question about restarting the shell...

the thing is i'm trying to script my whole LFS build as i go, so as not to have to re-type everything when i want to build it again...

in chapter 6, when we have to restart the shell, we do a:
Code:
exec /tools/bin/bash --login +h
my question is: can this be done from within a script?? cuz if i just stick that command in my script it won't go any further... is there some kinda trick i could use?? how can i restart a shell from within a script and have the script continue where it left??

Last edited by win32sux; 05-20-2006 at 09:35 PM.
 
Old 05-20-2006, 09:56 PM   #2
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
I'm probably saying something silly, but telinit may be helpful.
 
Old 05-20-2006, 10:11 PM   #3
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Original Poster
Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by Linux.tar.gz
I'm probably saying something silly, but telinit may be helpful.
thanks for the reply! could you provide an example of how telinit would do this within a script?? keep in mind the script is running in a chroot (i'm working through an xterm) on the host...

Last edited by win32sux; 05-20-2006 at 10:30 PM.
 
Old 05-20-2006, 10:43 PM   #4
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
Well, imho, telinit in a chroot leads to nothing. My idea was to do some kind of relaunch of the system in order to restart the login, like kdm or gdm do when they log an user automatically.
 
Old 05-21-2006, 04:07 AM   #5
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
How about a here document sent to STDIN of the new shell?
Code:
exec /tools/bin/bash --login +h << EOF
   echo "Hi, I'm the new shell."
   [...]
EOF
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
I made a shortcut to a shell script and it is using default shell icon... shlinux Linux - Software 2 04-20-2006 06:29 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:35 AM.

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