If i run some commands from ssh putty or gitbash they fail but the same commands give results from the machine console, why? i have attached screenshots of two tests.see image attached

  • 1
    Can you insert in the post the command line you are using? I suspect that the '|' character you are using is not a pipe, therefore being interpreted as a file instead – Ikaros May 4 '18 at 13:02
  • @Ikaros That's definitely not a pipe, as it was established in the answers below. – dr01 May 4 '18 at 14:46

Apart from the fact that the commands are actually different... You're using the wrong character for the pipe.

The correct character is |, not ¦.

Grep interprets it as a filename, that's why the commands fail.

  • 1
    ... and is why grep is reporting that the file file33.scp matches, and that it cannot find files named ¦ nor wc. – Jeff Schaller May 4 '18 at 14:19
  • 1
    To complete the analysis, since ¦ is not |, grep "^$" file33.scp ¦ wc -l looks like grep -l "^$" file33.scp ¦ wc, which is a command (grep), an option (-l), a regular expression argument ("^$"), and three filename arguments (file33.scp, ¦, and wc). So grep reports the name of the file (file33.scp) that contains (at least one) blank line, and then error messages for the other two files (which don’t exist). – G-Man May 4 '18 at 21:40

In the future it will be much easier for others to help if you include the text itself, not a screenshot. We can copy and paste text into our own terminals while we can't do so with images.

Here it looks like you're using a "broken bar" character ¦ where you should be using a "vertical bar" | (used as a pipe operator in bash). I'm guessing whatever "machine" console you mention (not shown?) interprets the keyboard press as a vertical bar, while Windows (git bash and putty) interpret it as a broken one.

  • Thank you, yah I see on my laptop the one that works is | not the other one the double dashed. Funny enough on my desktop the double dashed is the one that works and has no character |. I was confusing keys, thanks so much. – Morgs May 4 '18 at 13:12
  • Both the console and the putty screen show the same results. – Jeff Schaller May 4 '18 at 14:19
  • @JeffSchaller I understood the post to mean there are three terminals being interfaced with. Git Bash under Windows, Putty from Windows to some other machine, and the native Terminal on some machine other than the Windows one (not shown). – Kevin Kruse May 4 '18 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.