Skip to main content
deleted 29 characters in body
Source Link
jimmij
  • 48.7k
  • 20
  • 136
  • 141

It is very likely that the problem is that you have defined an alias in one of *rc files:

alias ls='ls --color=always'

In such case color codes survive pipe lines and mplayer getgets filenames surrounded by those codes. You can pass the output of command substitution $() to printf to see what mplayer really receives, e.g.:you would see something like

printf '%q\n' $(ls | sort -R)

You would see something like

$'\E[01;35mFile_1.ogg\E[0m'
$'\E[01;35mFile_2.ogg\E[0m'
$'\E[01;35mFile_3.ogg\E[0m'

Obviously mplayer reports correctly 'No such file or directory', but and prints full problematic file names including the escape codes, but the shell once again interpret these codes as a color, so you see only see names in the output what iscan be confusing.

To pass filenames correctly just run \ls or command ls or even start new shell with bash -f, so that bash won't use an alias but actualnative command

$ printf '%q\n' $(\ls | sort -R)
File_1.ogg
File_2.ogg
File_3.ogg

It is very likely that the problem is that you have defined an alias in one of *rc files:

alias ls='ls --color=always'

In such case color codes survive pipe lines and mplayer get filenames surrounded by those codes. You can pass the output to printf to see what mplayer receives, e.g.:you would see something like

printf '%q\n' $(ls | sort -R)

You would see something like

$'\E[01;35mFile_1.ogg\E[0m'
$'\E[01;35mFile_2.ogg\E[0m'
$'\E[01;35mFile_3.ogg\E[0m'

Obviously mplayer reports correctly 'No such file or directory', but and prints full file names including escape codes, but shell once again interpret these codes as a color, so you see only names in the output what is confusing.

To pass filenames correctly just run \ls or command ls so that bash won't use alias but actual command

$ printf '%q\n' $(\ls | sort -R)
File_1.ogg
File_2.ogg
File_3.ogg

It is very likely that the problem is that you have defined an alias in one of *rc files:

alias ls='ls --color=always'

In such case color codes survive pipe lines and mplayer gets filenames surrounded by those codes. You can pass the output of command substitution $() to printf to see what mplayer really receives, e.g.

printf '%q\n' $(ls | sort -R)

You would see something like

$'\E[01;35mFile_1.ogg\E[0m'
$'\E[01;35mFile_2.ogg\E[0m'
$'\E[01;35mFile_3.ogg\E[0m'

Obviously mplayer reports correctly 'No such file or directory', and prints full problematic file names including the escape codes, but the shell once again interpret these codes as a color, so you only see names in the output what can be confusing.

To pass filenames correctly just run \ls or command ls or even start new shell with bash -f, so that bash won't use an alias but native command

$ printf '%q\n' $(\ls | sort -R)
File_1.ogg
File_2.ogg
File_3.ogg
Source Link
jimmij
  • 48.7k
  • 20
  • 136
  • 141

It is very likely that the problem is that you have defined an alias in one of *rc files:

alias ls='ls --color=always'

In such case color codes survive pipe lines and mplayer get filenames surrounded by those codes. You can pass the output to printf to see what mplayer receives, e.g.:you would see something like

printf '%q\n' $(ls | sort -R)

You would see something like

$'\E[01;35mFile_1.ogg\E[0m'
$'\E[01;35mFile_2.ogg\E[0m'
$'\E[01;35mFile_3.ogg\E[0m'

Obviously mplayer reports correctly 'No such file or directory', but and prints full file names including escape codes, but shell once again interpret these codes as a color, so you see only names in the output what is confusing.

To pass filenames correctly just run \ls or command ls so that bash won't use alias but actual command

$ printf '%q\n' $(\ls | sort -R)
File_1.ogg
File_2.ogg
File_3.ogg