Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Absolute Beginner Talk
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Absolute Beginner Talk
The perfect starting place to find out more about computers, Linux and Ubuntu.

 
Thread Tools Display Modes
Old September 1st, 2007   #1
dwhitney67
Ubuntu addict and loving it
 
dwhitney67's Avatar
 
Join Date: Jun 2007
Location: Maryland, US
Beans: 3,564
Ubuntu 9.10 Karmic Koala
pushd and popd commands

Does anybody know which package provides the 'pushd' and 'popd' shell commands?

Is there any option available with apt-get that allows for me to determine this?

With yum (which is a Red Hat and Fedora tool similar to apt-get), there is such a feature. With apt-get, I can't tell.
dwhitney67 is offline   Reply With Quote
Old September 1st, 2007   #2
wormser
Fresh Brewed Ubuntu
 
wormser's Avatar
 
Join Date: Apr 2007
Location: Redmond, WA
Beans: 1,371
Ubuntu 8.04 Hardy Heron
Re: pushd and popd commands

With apt you use apt-cache search to find packages and to learn more apt-cache show to get the details of the package. I think ipopd is the package you are looking for.
wormser is offline   Reply With Quote
Old September 1st, 2007   #3
heimo
Skinny Extra Sweet Ubuntu
 
heimo's Avatar
 
Join Date: Apr 2005
Location: Finland
My beans are hidden!
Hardy Heron (Ubuntu Development)
Re: pushd and popd commands

Quote:
Originally Posted by dwhitney67 View Post
Does anybody know which package provides the 'pushd' and 'popd' shell commands?
Those are built-in commands in bash. I don't think there's a way to find this out using apt-tools, as those are not separate binaries in your system and for instance apropos doesn't know about those.
__________________
Docs, wiki, UDSF, tutorials, security
heimo is offline   Reply With Quote
Old September 1st, 2007   #4
dwhitney67
Ubuntu addict and loving it
 
dwhitney67's Avatar
 
Join Date: Jun 2007
Location: Maryland, US
Beans: 3,564
Ubuntu 9.10 Karmic Koala
Re: pushd and popd commands

Quote:
Originally Posted by heimo View Post
Those are built-in commands in bash. I don't think there's a way to find this out using apt-tools, as those are not separate binaries in your system and for instance apropos doesn't know about those.
Thanks for the enlightenment. For some reason I was thinking that pushd and popd came from a separate package. As you stated they don't... they are available with bash. I was trying to document where I obtained these, and now I remember that I "obtained" them when I replaced the link of /bin/sh to point /usr/bin/bash (in lieu of dash).

Anyhow, thanks.
dwhitney67 is offline   Reply With Quote
Old November 5th, 2007   #5
cmnorton
Fresh Brewed Ubuntu
 
cmnorton's Avatar
 
Join Date: Jun 2007
Location: Greater Boston
Beans: 1,538
Ubuntu 9.10 Karmic Koala
Re: pushd and popd commands

I have a shell script that came over from RedHat. I have read some posts indicating that I needed to change #!/bin/sh to #!/bin/bash. I did but my shell script still does not recognize pushd and popd.

What am I doing wrong?

Edit 11/05/07

I am supposed to install bash-builtins. I have, and will comment back here, if this solves my problem.

This is what the error looks like:

/home/ics/ics_util/DBImport: 202: pushd: not found
/home/ics/ics_util/DBImport: 209: popd: not found
__________________
cmn

Last edited by cmnorton; November 5th, 2007 at 11:22 AM.. Reason: Additional Information Found
cmnorton is offline   Reply With Quote
Old November 5th, 2007   #6
dwhitney67
Ubuntu addict and loving it
 
dwhitney67's Avatar
 
Join Date: Jun 2007
Location: Maryland, US
Beans: 3,564
Ubuntu 9.10 Karmic Koala
Re: pushd and popd commands

First verify if you have bash installed on your system. Run these commands:
Code:
$ ls -l /bin/bash
$ ls -l /bin/sh
The first command should tell you if you have bash installed. The second command tells you whether your system has linked 'sh' with 'bash'. Most Linux distros do this; Ubuntu does not.

If you do not have bash, get it using the apt-get command or synaptic.

If you are like me, and annoyed that Canonical decided to do something crude/different for the /bin/sh, blow away the link and set it to point to bash. This will obviate the need to edit scripts you may obtain from the third parties. Here's how you do that:

Code:
$ sudo rm -f /bin/sh
$ sudo ln -s /bin/bash /bin/sh
dwhitney67 is offline   Reply With Quote
Old June 10th, 2008   #7
linuxican
5 Cups of Ubuntu
 
Join Date: Sep 2006
Location: Rasht- Guilan - Iran
Beans: 15
Ubuntu 8.04 Hardy Heron
Send a message via Yahoo to linuxican Send a message via Skype™ to linuxican
Re: pushd and popd commands

Quote:
Originally Posted by dwhitney67 View Post
First verify if you have bash installed on your system. Run these commands:
Code:
$ ls -l /bin/bash
$ ls -l /bin/sh
The first command should tell you if you have bash installed. The second command tells you whether your system has linked 'sh' with 'bash'. Most Linux distros do this; Ubuntu does not.

If you do not have bash, get it using the apt-get command or synaptic.

If you are like me, and annoyed that Canonical decided to do something crude/different for the /bin/sh, blow away the link and set it to point to bash. This will obviate the need to edit scripts you may obtain from the third parties. Here's how you do that:

Code:
$ sudo rm -f /bin/sh
$ sudo ln -s /bin/bash /bin/sh
This worked.
Thanks dwhitney67

Saeed
__________________
Schoolinux: Free Your Class
www.schoolinux.com
linuxican is offline   Reply With Quote
Old June 10th, 2008   #8
Vivaldi Gloria
Fresh Brewed Ubuntu
 
Vivaldi Gloria's Avatar
 
Join Date: Oct 2007
Location: ISS
Beans: 1,429
Re: pushd and popd commands

Quote:
Originally Posted by dwhitney67 View Post
If you are like me, and annoyed that Canonical decided to do something crude/different for the /bin/sh, blow away the link and set it to point to bash. This will obviate the need to edit scripts you may obtain from the third parties. Here's how you do that:

Code:
$ sudo rm -f /bin/sh
$ sudo ln -s /bin/bash /bin/sh
The default shell is dash because it is faster. You may slow your boot time if you use bash rather than dash. I don't know actually whether there is an observable difference in boot times and I'd like to know.

But AFAIK you can use bash even if your /bin/sh links to dash. First make sure that your script starts with #!/bin/bash and it is executable. Now there is a difference between calling your script with

Code:
sh script
and

Code:
./script
The first one uses /bin/sh which is dash and the second one uses bash.

So to start your script with bash make sure that

1) It starts with #!/bin/bash
2) It is executable
3) You call it by name rather than "sh script".
Vivaldi Gloria is offline   Reply With Quote
Old June 10th, 2008   #9
dwhitney67
Ubuntu addict and loving it
 
dwhitney67's Avatar
 
Join Date: Jun 2007
Location: Maryland, US
Beans: 3,564
Ubuntu 9.10 Karmic Koala
Re: pushd and popd commands

There are many 3rd-party scripts that begin with the "#!/bin/sh". Do you suggest I edit each one I encounter so that it has "#!/bin/bash"?

I know, I realize that this is not an everyday problem, but still it is annoying to troubleshoot an error when a script works flawlessly on one *nix system, but not on Ubuntu.

With dash, and I believe this is how this thread got started, the commands 'pushd' and 'popd' are not available. Similarly, a simple command like the following is also doesn't work:
Code:
$ cp myfile{,.bak}
What option do I have at my disposal when merely using the command line? Maybe that's where supporters of dash should weigh in.
dwhitney67 is offline   Reply With Quote
Old June 10th, 2008   #10
Vivaldi Gloria
Fresh Brewed Ubuntu
 
Vivaldi Gloria's Avatar
 
Join Date: Oct 2007
Location: ISS
Beans: 1,429
Re: pushd and popd commands

Quote:
Originally Posted by dwhitney67 View Post
There are many 3rd-party scripts that begin with the "#!/bin/sh". Do you suggest I edit each one I encounter so that it has "#!/bin/bash"?.
Actually, that is exactly what I suggested. But I understand if you don't like it.
Vivaldi Gloria is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:55 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry