Ex() in /etc/skel/.bashrc

Not sure if this is the right place to post this.

The default .bashrc ( /etc/skel/.bashrc) for Manjaro contains a function “ex - archive extractor”, but when I tried to extract a file with space with it, I got an error:

$ ex "file name.tar.gz" 
bash: [: file: binary operator expected
'file name.tar.gz' is not a valid file

I guess this is because $1 is not quoted in .bashrc?

Seems to work here.
I guess you have spaces in your file name.
Yeah … it might break then.
(so will a lot of other things … generally *nix doesnt use spaces in filenames)

…though I suppose it may be a simple fix…

Substitute the first line of that function by… :arrow_down:

if [ -f "$1" ] ; then

I agree with you that using spaces in file names is a bad idea but that’s not an acceptable reasons for shell scripts to break ! Quoting variables in bash is the first thing anyone intending to use bash seriously has to learn.

So yeah, definitely a bug in the .bashrc !
Since /etc/skel/.bashrc is provided by a Manjaro specific package, it is easy to fix !
Failing to do so would really look amateurish in total contradiction with what Manjaro stands for.

okey doke. no need to be alarmist.
The relevant people will be notified and probably fix it ASAP.
I never even knew the thing existed … I wouldnt be surprised to find it is from years ago previous team members and never thought of again.

I don’t know when it was introduced, but it was either way already in my ~/.bashrc when I first installed Manjaro in April 2019. :man_shrugging: