Weird issue - *ksh script not recognized when being called

HI Team -

I'm running into a weird issue when trying to call a .ksh script.

In my shell script, I'm using the following command to call my environment file:

cd /hypbin/test
./_env.ksh

But it's saying not found. Permissions are set correctly, shebang is set but I'm unsure why it's not recognized.

I tried the following thinking there were white spaces:

cd /hypbin/test
"./_env.ksh"

Any ideas?

Thanks!

It's a bit unclear. You want to load _env.ksh into your current script?

If so, you need to source it in your script.

source ./_env.ksh
# or
. ./_env.ksh

If not, there could be a few other reasons, but it's hard to say based on the info you've given.

Can you post the shebang you're using (unless you do plan to source the file, in which case it makes no difference as it's just a comment), and an long listing of the files we're talking about?

1 Like

HI Scott -

Thank you so much!

Shebang is as follows:

#!/usr/bin/ksh

Also source did not work as it says "source not found" and when using the . ./ method, it says ^M: not found.

The purpose is to call the _env file to set some variables.

You'd probably want to get rid of those ^Ms to start with.

dos2unix # if it's installed
# or
tr -d "^M" < file > newfile # ^M = Control-V followed by Control-M
1 Like

Wow - I feel so stupid. This was bush league!

Thank you, Scott. Sorry for the bother. Been a long week :slight_smile:

Haha. No worries :slight_smile: