Skip to content

Commit

Permalink
Merge pull request #863 from nitram509/fix-escaping-parameters
Browse files Browse the repository at this point in the history
dlf script, escape parameters before handing over to bash
  • Loading branch information
xtreme-shane-lattanzio authored Dec 1, 2021
2 parents 848fd2e + ee8f5a1 commit 3f9fa83
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions dlf
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/bin/bash
if `which docker > /dev/null`; then
if [ $# -eq 0 ]; then
docker run -v $PWD:/scan -it licensefinder/license_finder
else
docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan && `echo $@`"
fi
if [ $# -eq 0 ]; then
docker run -v $PWD:/scan -it licensefinder/license_finder
else
escaped_params=""
for p in "$@"; do
escaped_params="$escaped_params \"$p\""
done
docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan && $escaped_params"
fi
else
echo "You do not have docker installed. Please install it:"
echo " https://docs.docker.com/engine/installation/"
Expand Down

0 comments on commit 3f9fa83

Please sign in to comment.