LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices

Reply
 
Search this Thread
Old 04-08-2010, 08:06 AM   #1
shravee
Member
 
Registered: Sep 2009
Posts: 57

Rep: Reputation: 15
Post y do i use bash command here ?


hi all,

I was doing a deployment of a .war file in AIX unix box.

after this, I am supposed to update a web.xml file in the .WAR file.

so i typed
jar -uvf wfr.WAR web.xml


but on entering the above command in the cmd promt , it did not work.
the err message what i received was " jar not found ".

INSTEAD WHEN I TYPED " bash " in command line and hit enter.

and again in the next line of command prompt when i executed the jar command . it functioned well..

so i want to know what was the function of bash. after which jar command executed.


also before using bash.. my command prompt appeared as " $ "

after entering bash my command prompt changed to my [ login /functional id enclosed in brackets.]

regards
shravan

Last edited by shravee; 04-08-2010 at 11:46 PM. Reason: included the error message.
 
Old 04-08-2010, 08:12 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Moved to the AIX forum.

BASH is one of many shells used on Unix and Linux systems.

Just a guess: You were running some other shell and then switched to BASH. Presumably, the "jar" command works in BASH but not in your other shell.
 
Old 04-08-2010, 08:50 AM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,610

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
Quote:
but this command did not execute on the first go.
Be more specific.
 
Old 04-08-2010, 11:26 PM   #4
shravee
Member
 
Registered: Sep 2009
Posts: 57

Original Poster
Rep: Reputation: 15
hi AlucardZero, I have edited my post to make it more clear and understanding as u wished.
plz let me know if u know what is the reason behind it.

regards
shravan
 
Old 04-08-2010, 11:43 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,531
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
It might help if you told us what actually happened when "it did not work".
 
Old 04-08-2010, 11:49 PM   #6
shravee
Member
 
Registered: Sep 2009
Posts: 57

Original Poster
Rep: Reputation: 15
Hi catkin, I have included the err message. it was " jar not found ".
but do let me know wats d gen purpose of typing " bash " in the cmd prompt.

regards
shravee
 
Old 04-09-2010, 12:12 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,531
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by shravee View Post
Hi catkin, I have included the err message. it was " jar not found ".
but do let me know wats d gen purpose of typing " bash " in the cmd prompt.
Oops! Sorry -- I missed that

When you type bash at the command prompt and press return, it starts a non-login interactive bash shell as a child of the current shell. The pstree command should illustrate that.

One possible explanation of why jar runs under the new shell but not under the old is that the PATH is different. echo $PATH should show that and should include jar's directory as shown by type jar.
 
Old 04-09-2010, 01:44 AM   #8
shravee
Member
 
Registered: Sep 2009
Posts: 57

Original Poster
Rep: Reputation: 15
hi catkin,

so can i take it granted that bash in general is used to create a new child shell under the same id.

regards
shravee
 
Old 04-09-2010, 02:20 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,531
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by shravee View Post
so can i take it granted that bash in general is used to create a new child shell under the same id.
That's not wrong but it is not the simplest and most comprehensive way of describing what happens when you run a command at the command prompt and what bash is.

When you enter a bash at the command prompt and press enter your current shell finds what bash is (you can do the same thing in a bash shell with type bash). In this case it finds it is /bin/bash. Your current shell then forks (produces an identical copy of itself with the single difference that the return code from fork lets the child process know it is the child). This being an identical process it is running as the same user (when you write id, I think you mean user). The child process, still running the same shell as your current shell, then calls exec which loads /bin/bash into the process (replacing your current shell in the child process with /bin/bash) and starts running it.

What bash does is described here. From your point of view the most important thing it does is (almost certainly) configure itself from ~/.bashrc and it is this file (or maybe another file that it references) that sets $PATH to a list which includes the jar program's directory.

There's no need to run bash to be able to run jar. You could configure your current shell's $PATH to include the jar program's directory. How to do that is dependent of which of several possible shells you are using. It is probably the one listed for your user in /etc/passwd.

Did you use pstree to see the relationship between your current shell and the bash shell you started from it?
 
Old 04-09-2010, 07:12 AM   #10
shravee
Member
 
Registered: Sep 2009
Posts: 57

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by catkin View Post
Did you use pstree to see the relationship between your current shell and the bash shell you started from it?

no, I did not use the pstree to check the relationships. I will definitely do it when I work on similar kind of deployment. I cant check it now as its not possible. I will definitely share at that time with you.

regards
shravee
 
  


Reply

Tags
bash, command


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Bash history delete command from bash itself ashishag Linux - Software 6 05-02-2010 03:39 AM
[SOLVED] Using a long Bash command including single quotes and pipes in a Bash script antcore Linux - General 9 07-22-2009 11:10 AM
Automatically append another piped command to issued command in bash amateen Programming 1 05-07-2009 06:36 AM
bash: <command name> command not found smash Programming 5 03-13-2006 08:48 AM
bash command Berticus Linux - Newbie 4 01-30-2006 04:22 AM


All times are GMT -5. The time now is 04:49 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration