LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-23-2005, 06:36 AM   #1
darkRoom
Member
 
Registered: Mar 2004
Location: Valencia, espaņa
Distribution: Slack, Gentoo, Custom
Posts: 162

Rep: Reputation: 30
shell script + change shell && continue


Hi
Is it possible to have a script which will execute this:
Quote:
exec /bin/bash --login
and then continue the rest of this script in this new shell ? I read that exec never retruns success so im thinking no, but hey if theres a possibility . . .

thanks
 
Old 02-23-2005, 07:01 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
dont think so.
 
Old 02-23-2005, 07:27 AM   #3
hiteshmaisheri
Member
 
Registered: Nov 2003
Location: Kerala, India
Distribution: Red Hat, Knoppix, Mandrake, FreeBSD
Posts: 231

Rep: Reputation: 30
hii,
if you rean the man page exec, it clearly states that it replaces the current shell
your can read the man page for the exec command it is as given below :
If command is specified, it replaces the shell. No new process
is created. The arguments become the arguments to command. If
the -l option is supplied, the shell places a dash at the begin-
ning of the zeroth arg passed to command. This is what login(1)
does. The -c option causes command to be executed with an empty
environment. If -a is supplied, the shell passes name as the
zeroth argument to the executed command. If command cannot be
executed for some reason, a non-interactive shell exits, unless
the shell option execfail is enabled, in which case it returns
failure. An interactive shell returns failure if the file can-
not be executed. If command is not specified, any redirections
take effect in the current shell, and the return status is 0.
If there is a redirection error, the return status is 1.
so it is no possible using exec command ...
you can write a c program fork a process and exec it using the scripts you want is the possiblity i seee...

Hitesh
 
Old 02-23-2005, 07:48 AM   #4
darkRoom
Member
 
Registered: Mar 2004
Location: Valencia, espaņa
Distribution: Slack, Gentoo, Custom
Posts: 162

Original Poster
Rep: Reputation: 30
ok thanks, that was what i was thinking,
 
Old 02-23-2005, 09:05 AM   #5
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Why don't you set your first line of script with :
#!/bin/bash --login
 
Old 02-23-2005, 09:27 AM   #6
darkRoom
Member
 
Registered: Mar 2004
Location: Valencia, espaņa
Distribution: Slack, Gentoo, Custom
Posts: 162

Original Poster
Rep: Reputation: 30
Thats a good point but i think the way to go now is write a c program to hold what im doing together. Im just learning how shell scripts work and i have a task which chains together a number of scripts, i guess im finding out what can and can't be done with scripts

thanks
 
Old 02-25-2005, 02:50 AM   #7
hiteshmaisheri
Member
 
Registered: Nov 2003
Location: Kerala, India
Distribution: Red Hat, Knoppix, Mandrake, FreeBSD
Posts: 231

Rep: Reputation: 30
All the best .. do post as many questions as you can.. we will be happy to learn from your experiences and share each others knowledge and experiences...
 
  


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
[Req]: How to config WebSvr & DNS Svr from console by Bash shell script CiF Linux - Networking 2 03-22-2005 12:31 AM
Looking for addusesr&passwd shell script szklanka Programming 1 02-22-2005 08:37 PM
shell scripts & change dir pit1516 Linux - Newbie 6 06-22-2004 10:42 AM
Shell Script with ssh & scp ErikJohnson Linux - Software 3 03-11-2004 04:53 PM
Shell Script with ssh & scp ErikJohnson Linux - Networking 1 03-11-2004 04:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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