Skip navigation

bash: command not found after piping

5311 Views 25 Replies Latest reply: Mar 30, 2014 4:42 PM by Peter Jarvis RSS
  • torkildr Calculating status...
    Currently Being Moderated
    Aug 17, 2012 9:52 AM (in response to MMHein)

    I believe I can shed some light on this issue. Since I bought my first MacBook Pro in 2009 I've occasionally seen this problem, but I've not let it me bother me too much as I could work around it. Even when buying a new MBP earlier this year I got the same problem. Now I do a lot of programming in Java using Eclipse. And the few times I use the OR operator (pipe symbol) the space after it will be underlined, indicating an illegal character. So what I do is to step back. Delete the character and type space. I figured this was just some quirk in Eclipse and did not connect the two until today.


    So I tried the same when in the shell when typing a command with several pipes - and the command worked! I took a look at the command in a hex editor and strangely found "7CCA" instead of "7C20" ("|" followed by a space). Playing around with the hex editor I also saw that holding Alt+7+Space together always produced "CA".


    Now I have Norwegian keyboards so I suspect that there is some software issue which is also present when using German keyboards.

  • torkildr Level 1 Level 1 (0 points)
    Currently Being Moderated
    Aug 18, 2012 1:02 PM (in response to torkildr)

    I filed a bug report with Apple; describing this problem. Let's hope we can start typing at our normal pace, instead of resting every time after a pipe.

  • Chris.Page Calculating status...
    Currently Being Moderated
    Aug 22, 2012 7:24 PM (in response to MMHein)

    [Deleted my message to repost via preferred account.]

  • Xtra Crispy Calculating status...
    Currently Being Moderated
    Aug 22, 2012 7:29 PM (in response to MMHein)

    On most keyboard layouts, typing Option-Space produces a non-breaking space character (NO-BREAK SPACE Unicode: U+00A0, UTF-8: C2 A0). Since typing a pipe with your keyboard layout requires using the Option modifier key, you're likely not releasing it before typing the subsequent space.

  • torkildr Level 1 Level 1 (0 points)
    Currently Being Moderated
    Aug 22, 2012 11:09 PM (in response to Xtra Crispy)

    I've been programming for close to 20 years and I'm a pretty fast typer. So that is quite likely. This is fairly annoying though so I think there should be away to avoid it. Maybe by adjusting keyboard settings. I've got more use for pipe space than U+00A0.

  • RKGer Calculating status...
    Currently Being Moderated
    Oct 18, 2012 8:21 AM (in response to Xtra Crispy)

    Thanks for the hint! I occasionally experienced the same problem and yes, it's because I typed Option-Space.

  • Xtra Crispy Level 1 Level 1 (0 points)
    Currently Being Moderated
    Oct 19, 2012 3:50 AM (in response to MMHein)

    The issue is that you're accidentally pressing the Option modifier key and typing Option-Space, which enters a non-breaking space, which isn't recognized by the shell. You can configure bash to treat non-breaking spaces as regular spaces by putting the following in ~/.inputrc:


    # Map (UTF-8) non-breaking space to regular space, in case the user

    # accidentally types Option-Space when they meant Space.

    "\xC2\xA0": " "

  • Adam Mercado Level 1 Level 1 (10 points)
    Currently Being Moderated
    Feb 8, 2013 12:42 PM (in response to MMHein)

    Good find. Too bad Linc unsubscribed from the thread, he might have learned something. I guess when you are a Level 9 you must feel you are above learning new answers, and 'reinstalling the OS is the only option. Good work for sticking with it and finding the 'real' answer

  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    Feb 8, 2013 12:52 PM (in response to Adam Mercado)

    I guess when you're level 1 you haven't learned how frustrating it is to reason with someone whose mind is set on doing something against their own best interests.  Sometimes being mule-headed gets someplace useful, but mostly it just digs deeper holes. 

  • YayBjorn Calculating status...
    Currently Being Moderated
    Jun 5, 2013 12:59 PM (in response to Linc Davis)

    This is why the sollution is not "reinstall your system". Figuring out what's actually happening instead is a much better approach generally in IT. Thanks to the guys who went that way I know what has been bothering for about a years time, thanks guys

  • Peter Jarvis Level 1 Level 1 (5 points)
    Currently Being Moderated
    Mar 30, 2014 4:42 PM (in response to MMHein)



    The other scenario where I have seen grep return the error "No Such file or Directory" is when you have a misconfigured environment variable:


    For example if we add the following line to .bash_profile


    set GREP_OPTIONS=="--color=always"


    and then run [ source .bash_profile; /bin/ps ax | /usr/bin/grep -i grep ] we get the error...


    $ source .bash_profile; /bin/ps ax | /usr/bin/grep -i grep

    grep: grep: No such file or directory


    if we edit the .bash_profile and remove the second '=' sign


    set GREP_OPTIONS="--color=always"


    and then rerun the command [ source .bash_profile; /bin/ps ax | /usr/bin/grep -i grep ] we get no errors


    $ source .bash_profile; /bin/ps ax | /usr/bin/grep -i grep

    78631 s001  S+     0:00.00 /usr/bin/grep -i grep

1 2 Previous Next


More Like This

  • Retrieving data ...

Bookmarked By (4)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.