On a WSL Ubuntu 16.04 (Xenial) with composer I executed:

echo 2 * 3 > 5 is a valid inequality 

It resulted in a file by the name of 5, with the content:

2 composer-setup.php 3 is a valid inequality

I don't know why this echo includes the text composer-setup.php as well; it should have included everything from left and right besides 5 (the file name) as echo can have a single stream of text as its file name for redirection (no spaces allowed, as I understand, hence the 5 name).

Why is the composer-setup.php appears there between the 2 and 3?


You've executed a commandline that has two shell-special characters in it: * and >. You saw what > did; the * is a wildcard / globbing character that picked up every1 file in your current directory. You have one file, named composer-setup.php in your current directory.

Quote your commandline; single-quotes work if there are no single-quotes in your text:

echo '2 * 3 > 5 is a valid inequality'

1: every file (or directory, socket, etc) that doesn't start with a period, unless you've set a shell option (such as dotglob) to specifically enable dot-file globbing.

  • @John, regarding your suggested edit, the wildcard/glob picks up directories and sockets and pipes, etc. -- not just "regular files" – Jeff Schaller Dec 8 '18 at 12:49

There are two things happening here...

First is that the shell sees the * character and replaces it with a list of files in the current directory. This is known as "globbing"

In addition the > 5 is seen as a redirection command.


echo 2 * 3 > 5 is a valid inequality 

Is parsed as

echo 2 * 3 is a valid inequality > 5

This results in a file called "5" being created with the contents "2 list of current files 3 is a valid inequality".

To prevent this from happening we need to use quotes

echo '2 * 3 > 5 is a valid inequality'

The '...' prevents the shell from interpreting the special characters and displays the string you entered.

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.