You are not logged in.

#1 2025-02-13 13:51:46

timpie
Member
Registered: 2025-02-09
Posts: 5

all commands after pipe - return command not found

Hello there,

I feel kinda strange, after 20 years of unix/linux experience i finally cannot grasp this problem and need to
post a newbies question :-) Oh well, we can always learn smething new
Running latest Arch Linux, bash, and everytime i run a command piping the output to another command
results in command not found ..
What is happening?

tim@jarabi:~$ cat /etc/passwd | grep tim
bash:  grep: command not found
tim@jarabi:~$ which grep
/usr/bin/grep
tim@jarabi:~$ sudo dmesg -T | less
bash:  less: command not found
tim@jarabi:~$ which more
/usr/bin/less
tim@jarabi:~$ sudo lsblk | more
bash:  more: command not found
tim@jarabi:~$ which more
/usr/bin/more

Offline

#2 2025-02-13 14:18:28

mithrial
Member
Registered: 2017-03-05
Posts: 151

Re: all commands after pipe - return command not found

There is a weird whitespace after the pipe symbol which resolves the command afterwards to

␣grep

Can you test another keyboard?

Offline

#3 2025-02-16 11:27:10

timpie
Member
Registered: 2025-02-09
Posts: 5

Re: all commands after pipe - return command not found

mithrial wrote:

There is a weird whitespace after the pipe symbol which resolves the command afterwards to

␣grep

Can you test another keyboard?

Did that, Same problem

Offline

#4 2025-02-16 15:36:24

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,422

Re: all commands after pipe - return command not found

What happens if you use the absolute path:

ls -R ~/videos | /usr/bin/grep porn # and inb4 anyone complains to not grep ls, I haven't made a porn reference in like a month, so shut up

Offline

#5 2025-02-16 15:56:57

loqs
Member
Registered: 2014-03-06
Posts: 18,877

Re: all commands after pipe - return command not found

As a work around you can remove the spaces and still use pipe in many cases such as:

$ cat /etc/passwd|grep tim
# dmesg -T|less

Offline

#6 2025-02-16 16:08:35

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,422

Re: all commands after pipe - return command not found

I don't even see that "weird whitespace" and copypasting the post into hexdump -C just shows 0x20 either.

Offline

#7 2025-02-16 19:14:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: all commands after pipe - return command not found

The space is in the error message from bash.  The OP gave an *attempt* at diagnostics with "which more", but whiches should be burned at the stake.  A relevant diagnostic would be "type more" - I'd wager this will show that it is an alias.  And I'd further wager that the OP has a set of alias's that add whitespace for common commands (probably something to do with using with sudo, but I've not used that tool in a long time).  And finally I'd wager they copy-pasta'd these aliases from a website into a shell config file.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2025-02-16 21:02:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,422

Re: all commands after pipe - return command not found

smile

There's indeed a second 0x20, but

$ alias grep=' grep'
$ which grep
/usr/bin/grep # so which is useless
$ type -a grep
grep ist ein Alias von » grep«.
grep ist /usr/bin/grep
grep ist /sbin/grep
grep ist /usr/sbin/grep
# but
$ echo foo | grep foo
foo # bash seems unimpressed

Because of the pipe my money would have been on the subshell screwing $PATH - we'll see.

Offline

#9 2025-02-19 14:48:23

timpie
Member
Registered: 2025-02-09
Posts: 5

Re: all commands after pipe - return command not found

It seems by selecting another keyboard layout it was solved from Belgian (alt) to Belgian ...

Offline

#10 2025-02-19 15:20:13

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,422

Re: all commands after pipe - return command not found

That does not seem overly likely - your OP has that stray blank, but the bar is normal.
What display server and desktop environment is this?
What does "xev -event keyboard" print for the bogus(?) layout when entering "a|b"?

Offline

Board footer

Powered by FluxBB