webjob on webapp, and shell globbing for file path

laurent-33 146 Reputation points
2021-03-01T10:12:08.627+00:00

Hello,

I write a little bash script that I would like to run with a triggered webjob, and there is an error with this line :

            main_chunk=$(ls $WEBROOT_PATH/static/js/main.*.js)

The error is that it cannot find the file.

What I have noticed :

  • when running the script manually, doing 'sh update.sh' in the cmd console in the advanced tool of the webapp in azure portal => it is OK, file is well found
  • if I replace the (not really) regex star '*' of the file path, example : main_chunk=$(ls $WEBROOT_PATH/static/js/main.165484.chunck.js) => OK, the webjob is sucessfull

So I think it is the shell globbing that seems not to work with the webjob execution (but ok with cmd console).
If you have some idea to solve this,

Thanks for your help,
laurent

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,829 questions
{count} votes

Accepted answer
  1. Ryan Hill 25,476 Reputation points Microsoft Employee
    2021-03-02T04:23:09.287+00:00

    Hi @laurent-33 ,

    We do have a workaround. Enclose the environment variable in quotes (") e.g. "$WEBROOT"/static/js/main.*.js and the globbing should work as expected.

    Regards,
    Ryan


0 additional answers

Sort by: Most helpful