Copying a script from a PDF file to Vim, Nano, text editor. Bad interpreter and other errors

General support questions
Post Reply
kadwm00
Posts: 16
Joined: 2022/09/19 14:55:18

Copying a script from a PDF file to Vim, Nano, text editor. Bad interpreter and other errors

Post by kadwm00 » 2022/11/16 16:59:55

One of my projects is to write up some instructions to install Cadence software packages properly, and I have some scripts that need to be set up for it to work. If I had to start from scratch or handed this PDF install guide to someone, I want them to be able to copy the scripts in the PDF to a text editor like Vim, Nano, or the standard GUI text editor with the OS and make sure the proper Unix control character is at the end when saving the script. I'm under the impression that this happens automatically.

I did get a bad interpreter error, which is covered here:
viewtopic.php?t=32380

So this would be in the PDF opened in CentOS PDF reader and the user copies it so it can be saved as a bash script:
# Provide paths to a Cadence application
PATH=$PATH:/home/administrator/cadence/installs/IC618/bin
PATH=$PATH:/home/administrator/cadence/installs/GENUS211/bin
PATH=$PATH:/home/administrator/cadence/installs/INNOVUS211/bin
export PATH
For best results in terms of no errors, should this be copied from the PDF into Vim, Nano, or another Linux text editor? The PDF would be opened in CentOS for example. If I copy this file in Windows from the PDF to Notepad++, there is a CRLF at each end. Does this become the proper LF in Linux?

Another thing I found is that I did not get the 'ksh' installed automatically, so I had to install that. When I tried executing a command like 'genus', which is an installed Cadence package, I got the following:
"WARNING: not possible to detect OS, missing lsb_release command!'

I looked up the lsb_release and installed that to.
https://www.thegeekdiary.com/lsb_releas ... ntos-rhel/

It seems I should put in my instructions to make sure that 'ksh' and 'lsb_release' is installed. That seemed to fix my issue with bringing up 'genus' and another package executed by command line.

I noted that from reading things online, a 'cat -A' will show the above script for example and each line will have a '$' at the end which I take for the proper unix end of line if the file is made in Vim or another Linux text editor.

I'm trying to understand better this vital nitpicky detail because there seems to be more than one reason to get errors like 'bad interpreter' or the 'lsb_release' issue. Maybe this not the case, so I'm trying to understand how this works.
Attachments
Bash script with LF at end
Bash script with LF at end
linefeeds after copying.jpg (32.17 KiB) Viewed 613 times

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

Re: Copying a script from a PDF file to Vim, Nano, text editor. Bad interpreter and other errors

Post by tunk » 2022/11/16 17:57:49

... there is a CRLF at each end. Does this become the proper LF in Linux?
If you need to convert from CRLF, you could use dos2unix, or maybe tr or sed:
https://stackoverflow.com/questions/261 ... newline-lf

kadwm00
Posts: 16
Joined: 2022/09/19 14:55:18

Re: Copying a script from a PDF file to Vim, Nano, text editor. Bad interpreter and other errors

Post by kadwm00 » 2022/11/16 20:11:43

I did find and apply the dos2unix, but I'm trying to get the heart of how the EOF works when copying in Linux so I can explain this critical detail. I'm a new Linux user and not familiar with the subtle details. I would guess not many new users are either. I'm also aware of the 'set ffs=unix' in Vim. I'm trying to determine the best way to explain this.

kadwm00
Posts: 16
Joined: 2022/09/19 14:55:18

Re: Copying a script from a PDF file to Vim, Nano, text editor. Bad interpreter and other errors

Post by kadwm00 » 2022/11/18 14:32:18

I had a workstation where I still had not set up the sh.local file with the script shown. It does appear if I copy the script from PDF into Nano, and save it, the script in sh.local did work with a log in under an administrator password.

I'm now trying to solve why with a non-administrator ID the printenv shows that the under this log-in the license environment variable is there and the paths, but I cannot execute the commands to load the Cadence software.

Post Reply