limey-bean / Anacapa

Written by Emily Curd (eecurd@g.ucla.edu), Jesse Gomer (jessegomer@gmail.com), Gaurav Kandlikar (gkandlikar@ucla.edu), Zack Gold (zjgold@ucla.edu), Max Ogden (max@maxogden.com), Lenore Pipes (lpipes@berkeley.edu)and Baochen Shi (biosbc@gmail.com). Assistance was provided by Rachel Meyer (rsmeyer@ucla.edu).
MIT License
42 stars 19 forks source link

Remove explicit sh from command spawning #29

Closed max-mapper closed 6 years ago

max-mapper commented 6 years ago

During my containerization process I've been getting source: command not found errors. I tracked it down to usage of sh explicitly in the various Anacapa shell scripts.

So I would recommend changing lines like this:

sh ~/Anacapa_db/scripts/anacapa_release_V1.sh

To simply this:

~/Anacapa_db/scripts/anacapa_release_V1.sh

Since all of the .sh files have #!/bin/bash at the top putting sh before them in the commands is unnecessary, and in fact is overriding bash and forcing it to use sh, which is causing my issue here.

The reason is:

https://stackoverflow.com/questions/13702425/source-command-not-found-in-sh-shell

/bin/sh is usually some other shell trying to mimic The Shell. Many distributions use /bin/bash for sh, it supports source. On Ubuntu, though, /bin/dash is used which does not support source. If you cannot edit the script, try to change the shell which runs it.

I think the version of sh on Hoffman is bash, but on other systems (such as in my Ubuntu container) the sh doesn't support source.

jessegomer commented 6 years ago

Hey, what do you think of changing it to call bash explicitly? I am concerned some users will not know how to make the intermediate scripts that are generated executable.

max-mapper commented 6 years ago

@jessegomer oops sorry never responded, yea that would work too!

max-mapper commented 6 years ago

this is almost done except the lines https://github.com/limey-bean/Anacapa/blob/8b87d6745442c4cb68fe6b97481418492336aa2a/Anacapa_db/anacapa_QC_dada2.sh#L215-L217 embed sh in the generated files rather than bash

edit also sh is embedded in the generated blca scripts too