So I used this command and I was able to access my script
sed -i -e 's/\r$//' micro.sh
But now I am getting this error while using the command ./micro.sh help
[INFO] Read input
./micro.sh: line 22: cd: too many arguments
So I went to the home directory and directly accessed the script like this /path/to/script/micro.sh help
And I was able to access the help menu but when I am trying to pack it is not letting me do that. I am getting this error now
[INFO] Read input
[INFO] Start packaging
[INFO] Check input
[ERROR] Stopped: missing docker directory in work directory: /home/rooot
find: ‘docker’: No such file or directory
[ERROR] Stopped: missing dockerfile in work directory: /home/rooot
[ERROR] Stopped: missing cumulocity.json in work directory: /home/rooot
[WARNING] Pack skiped
Even though I have the docker folder and json file in my /path/to/script directory. Please help me understand how can I do the packing of my project with the script. I am not able to understand what I am doing wrong.
I think you’re executing the script from the wrong directory. If you’re having this folder structure:
home
└── dirA
└── dirB
└── dirC
└── script.sh
And you’re executing ./dirA/dirB/dirC/script.sh from your home directory, the script is executed within the home directoy (and not within dirC). So the script is trying to find your Dockerfile in home and fails.
You could try to navigate to the correct directory and start it from there. Alternatively, there’s a --dir parameter you can use to specify your work directory (personally never used it, but should work).
please check the output of “pwd” manually before starting the script.
Looks like it was not returning a value, therefore “cd $WORK_DIR” was jumping to the home-directory of the current user (like root in your case) instead of jumping to the current directory (for the case there was no -dir or --directory parameter in your command line).
One option might be to have the “cd $WORK_DIR” active in the script, but explicitly provide the currernt directory to the -dir parameter. This will bypass the case, that pwd will not provide a valid value.