Why Can't I run my Unix Scripts and Programs?

We have a new AIX server that has been provided. I am setting up the software. WE use JD Edwards EnterpriseOne 8.11 Software.

I have copied the files/folders from our existing server to this new one. However, when I try to run any of the scripts or programs I get a message saing "not found". But I can see the scripts in the list. Also I  made sure I sudo as the owner of the files (psft811) but I still cant run or even get the system to see them. I did a ls -al and it clearly shows psft811 as the owner and that is the user I did a sudo su - psft811 with success.

What am I missing? See screen prints for details.  screen print2 screen print1
matrix0511Asked:
Who is Participating?
 
Murugesan NagarajanConnect With a Mentor Subject-matter expert at C++ C delivery, implementation, at UNIX oriented operating systems (Windows: CYGWIN_NT MINGW32_NT MINGW64_NT)Commented:
That is because of the environment variable "PATH"

You can execute any of the following
1.
cd /apps/PeopleSoft/E811/system/bin32
export PATH=".:$PATH"
rmics.sh

Open in new window


2.
cd /apps/PeopleSoft/E811/system/bin32
./rmics.sh

Open in new window


3.
export PATH="/apps/PeopleSoft/E811/system/bin32:$PATH"
rmics.sh

Open in new window

0
 
matrix0511Author Commented:
As a way to try and test I tried to run the script "rmics.sh" which is shown above. if you look at the first screen print you can see the "rmics.sh" script shows in the list with the owner being that psft811 user.  But I still can't run it or it says not found.
0
 
DavidPresidentCommented:
try ./scriptname    rather than just entering scriptname   your current directory is not part of your path.
0
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
Murugesan NagarajanSubject-matter expert at C++ C delivery, implementation, at UNIX oriented operating systems (Windows: CYGWIN_NT MINGW32_NT MINGW64_NT)Commented:
Usage of "./" is dependent on the usage of the command where you are using rmics.sh

Example Code:
cat /home/sadhana/.Murugesan/ee/rmics.sh
#/bin/ksh
export PATHwithDot=".:$PATH"
export PATH=`echo $PATH | sed 's/:\.\/://g;s/^\.://g;s/:\.$//g;'`
echo "As of now PATH does not have ."
echo "value of \$PATH"
echo $PATH
export PATHWithoutDot="$PATH"
find $PWD/a -type d  -exec ls -ld {} \;
echo "output of the command using rmics.sh will be      rmics.sh: command not found"
rmics.sh
echo "This can be resolve using one of the following ways:"
echo "way1:"
export PATH="$PATHwithDot"
echo "now the output of rmics.sh"
rmics.sh
echo "way2:"
export PATH="$PATHWithoutDot"
echo "now the output of ./rmics.sh"
./rmics.sh
echo "way3:"
export PATH="$PATHWithoutDot"
echo "now the output of rmics.sh"
/home/sadhana/.Murugesan/ee/rmics.sh

Open in new window


cat rmics.sh
#!/bin/ksh
echo The name of this script is $0

Open in new window

0
 
matrix0511Author Commented:
Guys, I"m not a Unix expert so bare with me on this. But you are basically saying it's because the environment variables are not setup propery?

@murugesandins, can you explain how those commands allow me to use those scripts/programs?

And how can I set this up so that I don't have to manually enter all those commands each time I need to execute a script or program? I'm sure I will need to update my.profile? If so, what specific commands or path info do I need to update it with?

Thanks.
0
 
matrix0511Author Commented:
I think I just need a quick and dirty education in how the PATH/Environment variables work on Unix. I never quite understood it.

I come from a Windows background so I need more explanation on how it all works.

Thanks in advance.
0
 
matrix0511Author Commented:
Here is what my .PROFILE looks like. I'm sure I need to update this with PATH info. I just have no idea what to add to address this. profile.txt
0
 
Murugesan NagarajanSubject-matter expert at C++ C delivery, implementation, at UNIX oriented operating systems (Windows: CYGWIN_NT MINGW32_NT MINGW64_NT)Commented:
The PATH environment variable will be used to look into the command which you are executing.
For example:

$ export PATH="/home/poornima/.Murugesan:$PATH"
$ ls -l /home/poornima/.Murugesan/m1.sh /home/poornima/m1.sh
-rwxr--r--    1 poornima poornima       54 Oct 19 11:35 /home/poornima/.Murugesan/m1.sh
-rwxr--r--    1 poornima poornima       65 Oct 19 11:36 /home/poornima/m1.sh
$ m1.sh
this file is in the directory /home/poornima/.Murugesan


[code]
$ export PATH="/home/poornima/:$PATH"
$ m1.sh
this file is in the directory /home/poornima/

Open in new window




Assume there are 2 (script) developers who are creating "m1.sh"  in the following directories
      /home/poornima/m1.sh
      /home/poornima/.Murugesan/m1.sh
In this case the .profile should not be edited for updating PATH environment variable.
Those two users update their PATH environemt variable in their own terminal after logon.

Assume that there are 5  (script) developers  who are using all the scripts under the directory "/home/poornima/allScripts/" then .profile needs to be updated with PATH to contain the PATH environment variable.
0
 
Murugesan NagarajanSubject-matter expert at C++ C delivery, implementation, at UNIX oriented operating systems (Windows: CYGWIN_NT MINGW32_NT MINGW64_NT)Commented:
in the given .profile file
PATH contains the directories in the following sequence:
        /usr/bin
        /etc
        /usr/sbin
        /usr/ucb
        $HOME/bin
        /usr/bin/X11
        /sbin
        .

Hence the commands which are executed by all the users will be searched in the above mentioned directories in sequences.
0
 
Murugesan NagarajanSubject-matter expert at C++ C delivery, implementation, at UNIX oriented operating systems (Windows: CYGWIN_NT MINGW32_NT MINGW64_NT)Commented:
Url for Setting Environment Variables
https://www.ccs.uky.edu/docs/cluster/env.html
0
 
matrix0511Author Commented:
I apologize guys. But I'm still having trouble understanding this. Do I have to define a path to every directory I want to access in order for unix to allow me to run scrlipts/programs in those dirs?

That seems odd to me. and what does it mean when it states: "EXPORT PATH"?

This software I have setup (JD Edwards) is software that will be used by all users, so I don't want to have to issue PATH commands each time I need to run a program. Man, sorry, I'm just totally confused when it comes to understanding how these environment variables work.

I know with Windows, most of the Software that is setup or insalled...the install paths are defined in the Environment Variables setup. But looks like Unix is totally different.
0
 
matrix0511Author Commented:
maybe I should ask it like this. What PATHS should I have defined in my .profile in order to do what I'm trying to do?
0
 
Murugesan NagarajanSubject-matter expert at C++ C delivery, implementation, at UNIX oriented operating systems (Windows: CYGWIN_NT MINGW32_NT MINGW64_NT)Commented:
As I told earlier
You can add the following in .profile
export PATH="/apps/PeopleSoft/E811/system/bin32:$PATH"

Open in new window

so that you(and everyone who logon to that account) can execute rmics.sh from any directory


or:
You can add the following in .profile
export PATH=".:$PATH"

Open in new window

so that you(and everyone who logon to that account) can execute rmics.sh using the following
cd /apps/PeopleSoft/E811/system/bin32
rmics.sh

Open in new window



or:
without adding anything in the file .profile
so that you(and everyone who logon to that account) can execute rmics.sh using the following
cd /apps/PeopleSoft/E811/system/bin32
./rmics.sh

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.