-bash: ./p4: /bin/ksh^M: bad interpreter: No such file or directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting -bash: ./p4: /bin/ksh^M: bad interpreter: No such file or directory
# 8  
Old 04-28-2016
In your script:
Code:
export PATH=$PATH:/path/to

or specify the PATH variable absolutely, without a reference to $PATH.
# 9  
Old 04-28-2016
I use ksh as my login shell. The way I set PATH in my .profile file is:
Code:
PATH=$HOME/bin:$PATH:.
export PATH

which looks for commands in the bin subdirectory of my home directory first, the default locations set up by the system administrator on my system, and the current directory. I don' t include the current directory (specified by .) when I'm running as root, and many people never put . in PATH to avoid security issues that can pop up if you execute commands in a directory where other people can create files. If you put . in path anywhere but as the last entry, it makes this more likely to be a problem.

If you are using bash as your login shell, you need to set PATH in the first file in your home directory that has a name in this list: .bash_profile, .bash_login, and .profile. After updating the way you initialize PATH you will need to either log out and log back in or run the command:
Code:
. filename

where filename is the name of the file in which you changed the way you set PATH.
# 10  
Old 04-29-2016
Quote:
Originally Posted by Don Cragun
Try:
Code:
cp p4 _p4 && tr -d '\r' < _p4 > p4 && rm _p4

I think, in this case this can be done simpler using

Code:
dos2unis p4

provided this tool is available (usually it is).

---------- Post updated at 09:14 AM ---------- Previous update was at 09:07 AM ----------

Quote:
Originally Posted by cokedude
Yes I know, but no I did not remember. I thought I had my notepad++ set for unix files but it didn't work for some reason.
The Notepad++ settings for line endings apply for new files only. If you open existing files, Notepad++ uses the line endings for this file.

You can explicitly change the line endings (EDit/EOLconversion).

With View/ShowSymbol/ShowEndOfLine turned on, Notepad++ will actually show you the EOL character for each line. In addition, if you see in the status line the word "Unix", you know that \n line endings are used for this file.
# 11  
Old 04-29-2016
Quote:
Originally Posted by rovf
I think, in this case this can be done simpler using

Code:
dos2unis p4

provided this tool is available (usually it is).
I guess you mean dos2unix? And, it may NOT be available all about, not even common linux distributions, but needs to be installed.
# 12  
Old 04-29-2016
Quote:
Originally Posted by RudiC
I guess you mean dos2unix? And, it may NOT be available all about, not even common linux distributions, but needs to be installed.
Yes, thank you for pointing out the typo. I blame myself, plus the person who puts the S next to the X on the keyboard.

And, that's why I said: "provided it is available", but it is easy to get anyway.

BTW, since the OP is obviously working on Windows for editing, but having Unix as a target platform, he maybe has Cygwin installed too (it would make sense at least), and dos2unix is available as a Cygwin package also. I prefer it over blindly erasing all carriage returns, because if, for whatever reason, an isolated \r appears somewhere in my code, I don't want to go it silently away. It's a matter of taste, of course.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

#!/bin/bash cannot find file or directory

Hello, When i run a bash script on ubuntu i get this message.. #!/bin/bash cannot find file or directory... Can anibody help me with this, because the file actually exists.... Is there any extra configuration to be made? (5 Replies)
Discussion started by: oliveiraum
5 Replies

2. Shell Programming and Scripting

Bad Interpreter

Hi. My name is Caleb (a.k.a RagingNinja) form the whited00r forums. (Whited00r makes custom firmware for iOS devices). I have been learning and creating simple shells scripts. I have been recently using VIM for Windows or using VirtualBox to run the UBUNTU OS within VirtualBox to create my shell... (2 Replies)
Discussion started by: RagingNinja
2 Replies

3. Shell Programming and Scripting

bad interpreter when running script

Hi All, I'm not confortable in writing script, can someone can help me, when I run that script below i found this error code : -bash: ./script.sh: /bin/sh.: bad interpreter: Here is the script for i in * x=${i##*.} z=$(perl -e 'print time;') t=$(echo $z-$x|bc)... (12 Replies)
Discussion started by: bzb23
12 Replies

4. Shell Programming and Scripting

bad interpreter: Permission denied

Hi I am running a script: #!bin/bash set -x echo"select * from celldatamap;" || sqlcsv -v -h -s ',' -d MTNSA11G -u datasafe -p datasafe > andrea.csv When I run my script ./tablescript.sh I get the following error: $ ./tablescript.sh (3 Replies)
Discussion started by: ladyAnne
3 Replies

5. Shell Programming and Scripting

Perl - bad interpreter: No such file or directory

Here is a puzzler. To start, let me say that I've done a search on this issue and it is definitely not related to line endings being encoded in windows returns. I get this error when I run SOME perl scripts. I have a script called hello_world.pl. I do $cp hello_world.pl new_hello_world.pl... (0 Replies)
Discussion started by: mjmtaiwan
0 Replies

6. Ubuntu

How to resolve bad interpreter error

Hi, Iam trying to run a gmake command and have the latest version of Gnu in my redhat linux system. I need to execute the following steps; ---> chmod +x utils/* ---> ./utils/AllCodeManagerFix ---> gmake LINUX Iam able to do the chmod command but when I run the second command I get... (2 Replies)
Discussion started by: viji19812001
2 Replies

7. UNIX for Dummies Questions & Answers

bad interpreter: Permission denied

I am writing an expect script but am getting a bad interpreter: permission denied error. I don't think the error has anything to do with expect itself, I think I am missing something in how I start the file. For instance, when I run the file under the expect directory it works: cd... (7 Replies)
Discussion started by: earnstaf
7 Replies

8. Shell Programming and Scripting

#!/usr/bin/ksh Command Interpreter in a sh script

Hi, I have a developer that is trying to start a script with sh "scriptname". In the script, he is specifying #!/usr/bin/ksh as the command interpreter. For some reason sh is ignoring the #!/usr/bin/ksh. We are running Solaris 8. Does anyone have any ideas what could be causing this? Here... (3 Replies)
Discussion started by: ckeith79
3 Replies

9. Shell Programming and Scripting

/bin/sh: bad interpreter: Permission denied

today i started the LFS book (version 4.0). Basically i am using slackware 9.0 to try and install a new linux completely from source on another partition. Now i took the book's recommendations and created a user called lfs so i wouldn't have to do the stuff as root, and i have got the new LFS... (4 Replies)
Discussion started by: Calum
4 Replies

10. UNIX for Dummies Questions & Answers

/bin/sh: /usr/bin/vi: No such file or directory when doing crontab

I just set up an ftp server with Red Hat 5.2. I am doing the work, I'm baby stepping, but it seems like every step I get stuck. Currently, I'm trying to set up a crontab job, but I'm getting the following message: /bin/sh: /usr/bin/vi: No such file or directory. I see that vi exists in /bin/vi,... (3 Replies)
Discussion started by: kwalter
3 Replies
Login or Register to Ask a Question