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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-23-2005, 06:36 AM
|
#1
|
|
Member
Registered: Mar 2004
Location: Valencia, espaņa
Distribution: Slack, Gentoo, Custom
Posts: 162
Rep:
|
shell script + change shell && continue
Hi
Is it possible to have a script which will execute this:
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
|
|
|
|
02-23-2005, 07:01 AM
|
#2
|
|
Senior Member
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,211
Rep: 
|
dont think so.
|
|
|
|
02-23-2005, 07:27 AM
|
#3
|
|
Member
Registered: Nov 2003
Location: Kerala, India
Distribution: Red Hat, Knoppix, Mandrake, FreeBSD
Posts: 231
Rep:
|
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
|
|
|
|
02-23-2005, 07:48 AM
|
#4
|
|
Member
Registered: Mar 2004
Location: Valencia, espaņa
Distribution: Slack, Gentoo, Custom
Posts: 162
Original Poster
Rep:
|
ok thanks, that was what i was thinking,
|
|
|
|
02-23-2005, 09:05 AM
|
#5
|
|
Senior Member
Registered: Mar 2004
Distribution: Slackware
Posts: 4,282
Rep:
|
Why don't you set your first line of script with :
#!/bin/bash --login
|
|
|
|
02-23-2005, 09:27 AM
|
#6
|
|
Member
Registered: Mar 2004
Location: Valencia, espaņa
Distribution: Slack, Gentoo, Custom
Posts: 162
Original Poster
Rep:
|
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
|
|
|
|
02-25-2005, 02:50 AM
|
#7
|
|
Member
Registered: Nov 2003
Location: Kerala, India
Distribution: Red Hat, Knoppix, Mandrake, FreeBSD
Posts: 231
Rep:
|
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...
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:05 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|