Re: Issus with popd and pushd

2017-04-22 Thread Pete Smith
Thanks I was being a bit dense, didn't realize that the format you gave causes the commands to run in the parent shell. It works as it should! -Pete On Fri, Apr 21, 2017 at 10:52 AM, Chet Ramey wrote: > On 4/21/17 1:36 PM, Chet Ramey wrote: > > > I think the key takeaway

Re: Issus with popd and pushd

2017-04-21 Thread Chet Ramey
On 4/21/17 1:36 PM, Chet Ramey wrote: > I think the key takeaway is that this is trivial to do with a shell > function, even if you want to add argument parsing (use getopts) and > pass all the option arguments except -v to the builtins. On second thought, don't use getopts. -- ``The lyf so

Re: Issus with popd and pushd

2017-04-21 Thread Chet Ramey
On 4/21/17 11:48 AM, Pete Smith wrote: > It appears to me that the sub shell does inherit the dirs stack, but any > changes that are made to the dir stack remain > in the sub shell and do not propagate back to the parent shell. Correct; it's a separate process. > Does the exchanges of your

Re: Issus with popd and pushd

2017-04-21 Thread Pete Smith
Am clearly out of my league in these exchanges about possible implementation. Nevertheless am heartened by seeing these exchanges. As to the question that came up in the dialogue: > Um... don't you mean to use the alias command somewhere, like: > > alias popd='builtin popd|tr " " "\n"' I

Re: Issus with popd and pushd

2017-04-18 Thread Chet Ramey
On 4/18/17 2:13 PM, L A Walsh wrote: > Chet Ramey wrote: >> On 4/18/17 9:35 AM, Eduardo Bustamante wrote: >> >> >>> Or now that I think about it, you can get away with these functions: >>> >>> # masked builtins >>> dualbus@debian:~/foo/bar/baz$ pushd() { builtin pushd "$@" >/dev/null; >>> dirs

Re: Issus with popd and pushd

2017-04-18 Thread L A Walsh
Chet Ramey wrote: On 4/18/17 9:35 AM, Eduardo Bustamante wrote: Or now that I think about it, you can get away with these functions: # masked builtins dualbus@debian:~/foo/bar/baz$ pushd() { builtin pushd "$@" >/dev/null; dirs -v; }; popd(){ builtin popd "$@" >/dev/null; dirs -v; }

Re: Issus with popd and pushd

2017-04-18 Thread L A Walsh
L A Walsh wrote: Pete Smith wrote: The problem with: dirs, pushd, popd ... Using an alias solution: popd | sed 's/\s/\n/g' | nl Um... don't you mean to use the alias command somewhere, like: alias popd='builtin popd|tr " " "\n"' Then it seems to work. Is that what you mean by

Re: Issus with popd and pushd

2017-04-18 Thread L A Walsh
Pete Smith wrote: The problem with: dirs, pushd, popd ... Using an alias solution: popd | sed 's/\s/\n/g' | nl Um... don't you mean to use the alias command somewhere, like: alias popd='builtin popd|tr " " "\n"' Then it seems to work. Is that what you mean by using an alias?

Re: Issus with popd and pushd

2017-04-18 Thread Chet Ramey
On 4/17/17 5:57 PM, Pete Smith wrote: > Ahh that makes sense: > >"That will never change the current directory, since the popd is run in > a subshell." > > So what's the possibility of adding -v option to popd and pushd??? I'd advise doing it with a shell function first; that's much easier

Re: Issus with popd and pushd

2017-04-18 Thread Chet Ramey
On 4/18/17 9:35 AM, Eduardo Bustamante wrote: > Or now that I think about it, you can get away with these functions: > > # masked builtins > dualbus@debian:~/foo/bar/baz$ pushd() { builtin pushd "$@" >/dev/null; > dirs -v; }; popd(){ builtin popd "$@" >/dev/null; dirs -v; } This would be the

Re: Issus with popd and pushd

2017-04-18 Thread Eduardo Bustamante
On Mon, Apr 17, 2017 at 4:57 PM, Pete Smith wrote: [...] > So what's the possibility of adding -v option to popd and pushd??? Feel free to send patches. Under the hood, the pushd/popd builtins call the dirs builtin with no arguments after their execution, so it's just a

Re: Issus with popd and pushd

2017-04-17 Thread Pete Smith
Ahh that makes sense: "That will never change the current directory, since the popd is run in a subshell." So what's the possibility of adding -v option to popd and pushd??? -Pete On Mon, Apr 17, 2017 at 1:33 PM, Chet Ramey wrote: > On 4/17/17 2:05 PM, Pete Smith

Re: Issus with popd and pushd

2017-04-17 Thread Chet Ramey
On 4/17/17 2:05 PM, Pete Smith wrote: > Using an alias solution: > > popd | sed 's/\s/\n/g' | nl > > doesn't work, probably because they are shell built-ins. That will never change the current directory, since the popd is run in a subshell. -- ``The lyf so short, the craft so long to

Re: Issus with popd and pushd

2017-04-17 Thread Reuti
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Am 17.04.2017 um 20:05 schrieb Pete Smith: > The problem with: dirs, pushd, popd is that they output a single line of > paths that's difficult to parse visually quickly, especially when there are > many paths in the dir stack and the path >

Issus with popd and pushd

2017-04-17 Thread Pete Smith
The problem with: dirs, pushd, popd is that they output a single line of paths that's difficult to parse visually quickly, especially when there are many paths in the dir stack and the path names are long. dirs offers a reasonable solution with the -v option Unfortunately popd and pushd do NOT