This has driven me crazy so I hope someone can help. I have a script that works perfectly when executed manually or when restarting lightdm, but when it runs during a boot and auto-login, it returns a literal * instead of using it as a wildcard. It is set to run from


by including:

@/bin/sh /home/pi/finder.sh

the script includes:

fileName=( /media/pi/DISPLAY/display.* )
[[ -e $fileName ]]

I have used other iterations of code and search methods, but all have the same results. When this script is run under any circumstances other than a boot/login it returns a $fileName something like:




However, when the pi boots and performs its auto-login, it returns the exact $fileName of:


I have tried any number of alernative coding solutions, and even started with a simple find command. However, everything I do has the same results of working with:

sudo systemctl restart lightdm

but nothing I have tried works during the normal boot process and always returns a literal * instead of wilcard results.

  • 1
    i'm only guessing here. it may be that the boot-time shell is different from run-time shell
    – jsotola
    Commented Feb 25, 2018 at 5:28

2 Answers 2


The shell is run with turned-off globbing, most likely for "security reasons".

$ ls -1
$ echo *
a b
$ set -f
$ echo *
$ set +f
$ echo *
a b

You will get "/media/pi/DISPLAY/display.*" when there is no file corresponding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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