?
Solved

Run setup.sh when BASH shell starts.

Posted on 2004-10-14
5
Medium Priority
?
1,173 Views
Last Modified: 2012-06-21
I am sharing an account on a SUN unix box.  The owner of the account refuses to set a default shell.  When you first log in you have to start the desired shell.

Currently I am using the bash shell.  So when I login, I type the following:
  bash
  . ./setup.sh
(setup.sh initialises my personal aliases)

My question is:  Is there a way for me to do the same in one line?

In Windows shell I can do this by just typing CMD batfile.bat.
0
Comment
Question by:MogalManic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Expert Comment

by:avizit
ID: 12307420
you can type
 bash ../setup.sh

or source setup.sh  will work too i think

also read

read http:Q_10153144.html
0
 
LVL 21

Accepted Solution

by:
tfewster earned 375 total points
ID: 12309372
Why not copy the contents of setup.sh to .bash_profile?

Then, if you start bash with `bash --login`, it will execute your .bash_profile and set up the environment for you.

Or, have the command do `. ./setup.sh` in the .bash_profile.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 12312163
No need to type in anything.

Let's assume your default shell is /bin/sh, then in your .profile, put

[ -x /usr/bin/bash ] && exec /usr/bin/bash --login

And put the contents of setup.sh in your .bash_profile or call it from your .bash_profile
0
 
LVL 4

Expert Comment

by:pankajtiwary
ID: 12315674
If you are using bash shell, the easiest way to do this is open the .bash_profile in some editor, go to the last and in a new line type ../setip.sh
0
 
LVL 4

Expert Comment

by:pankajtiwary
ID: 12315681
MogalManic,
 Sorry for the typo, it should be ../setup.sh
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question