Home  |  About  | Last |  Submit  |  Contact
AllQuests.com



Previous Question:  Panel Icons always moving around  Desktop EnvironmentsNext Question:  [ubuntu] Compiz special desktop effects unavailable.  Absolute Beginner Talk
Question pushd and popd commands ( Ubuntu Forums Absolute Beginner Talk )
Updated: 2008-07-18 01:19:21 (9)
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.

Answers: pushd and popd commands ( Ubuntu Forums Absolute Beginner Talk )
pushd and popd commands

Quote:
Originally Posted by dwhitney67
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

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

pushd and popd commands

Quote:
Originally Posted by dwhitney67
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

pushd and popd commands

Quote:
Originally Posted by dwhitney67
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 1f40

linuxican

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

cmnorton

pushd and popd commands

Quote:
Originally Posted by dwhitney67
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 1f40

dwhitney67

pushd and popd commands

Quote:
Originally Posted by heimo
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

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

pushd and popd commands

Quote:
Originally Posted by dwhitney67
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.

heimo

Previous Question:  Panel Icons always moving around  Ubuntu Forums  Desktop EnvironmentsNext Question:  [ubuntu] Compiz special desktop effects unavailable.  Ubuntu Forums  Absolute Beginner Talk

- Source: pushd and popd commands Ubuntu Forums Absolute Beginner Talk
- Previous Question: Panel Icons always moving around Ubuntu Forums Desktop Environments
- Next Question: [ubuntu] Compiz special desktop effects unavailable. Ubuntu Forums Absolute Beginner Talk