0

I created a bash file and put a content like

echo "Enter current release dir:"
read release
php zipping.php
scp build.zip user@ipaddress:/path/to/releases/$release
scp docs.text user@ipaddress:/path/path/releases/$release
echo "success moving build.zip to live"
sudo rm build.zip
echo "deleted build.zip"

then run bash release

it successfully execute bash command, but

I moved that file somewhere and created a new bash file using touch release

and put content like

echo "Enter current release dir:"
read release

Now I got

Enter current release dir:
': not a valid identifierelease

error

Any idea?

Fil
  • 8,225
  • 14
  • 59
  • 85
  • What is the output of `type -a release` – Jetchisel Mar 20 '20 at 10:00
  • 2
    Check your script for `\r`. You can do so using `cat -A` for instance, if you see `^M` in the output those are `\r`s and can remove them with `dos2unix` if available or `tr -d $'\r'` otherwise – Aaron Mar 20 '20 at 10:00
  • In particular the error message you see looks something like `'somethingsomethingrelease\r': not a valid identifier`, where the part after the `\r` is written from the start of the line, overwriting previous content – Aaron Mar 20 '20 at 10:03

1 Answers1

0

After digging i just found this article

and I realized the i am in windows environment using WSL and have Ubuntu 16.04 installed therefore the file is windows encoding.

The solution is ssh user@ipaddress and in there performed touch release and download that using scp user@ipaddress:/user/release /path/to/download/release

Fil
  • 8,225
  • 14
  • 59
  • 85