Openvpncmd.sh broken

I’m trying to get the script referenced on this page to work.

I’m running IPFire 2.25 158, I copied the text from the page to a text file, saved it then transferred it over to the IPFire system, then do the chmod+x as instructed, then run it with ./openvpncmd.sh but each time I get this:

-bash: ./openvpncmd.sh: /bin/bash^M: bad interpreter: No such file or directory

/bin/bash does exist in that path with good permissions, I tried creating the with notepad and with atom.io then scp-ing the file over to IPFire to run, but it does not seem to function. the ^M keeps adding itself some how to the interpreter line. Does anyone have a working copy of that script that they can post a link to that I can perform a wget on directly to pull the file in without the extra \r \n \whatever crap?

Chris

“notepad” is the culprit, as it doesn’t respect *nix text file rules.

Using “vi” or “nano” on the IPFire system will allow you to correct the problem.

Alternatively, the following bash script (dos2unix) will work, but DO NOT create it using “notepad”:

#! /bin/bash
if [ ${#@} -eq 1 ] ; then
sed -i -e ‘s/\r$//’ $1
else
echo “Usage: $0 filename”
exit 1
fi

2 Likes

This might help also:

My $0.02 when on Windows use Notepad++ you can pick Unix EOL :ok_hand:t4: But as always, pick whichever works for you. Just remember to select the correct EOL setting

1 Like

I use the combination WinSCP ( for transfer of files ) and Notepad++ ( for editing ).
It is quite easy and straightforward. In WinSCP you can define Notepad++ as default editor, clicking ‘Edit’ opens it. Notepad++ allows the configuration of the EOL.

1 Like

Thanks for the tips everyone!

Same here, WinSCP & Notepad++ works for me. When I go a bit farther in my testing I use Docker Desktop + Visual Studio Code and virtualise it all :grimacing: