• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1210
  • Last Modified:

Run setup.sh when BASH shell starts.

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
MogalManic
Asked:
MogalManic
1 Solution
 
avizitCommented:
you can type
 bash ../setup.sh

or source setup.sh  will work too i think

also read

read http:Q_10153144.html
0
 
tfewsterCommented:
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
 
TintinCommented:
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
 
pankajtiwaryCommented:
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
 
pankajtiwaryCommented:
MogalManic,
 Sorry for the typo, it should be ../setup.sh
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now