hankknight
asked on
Linux: Run custom script without path
From the command line, I want "zzz" to echo 'Hello World'.
I created a file named 'zzz' and changed the permissions to 755:
It works when I type this in from a command line:
How can I get it to work without the dot and slash at the beginning?
I use CentOS 6.
I created a file named 'zzz' and changed the permissions to 755:
#!/bin/sh
echo Hello World
It works when I type this in from a command line:
./zzz
How can I get it to work without the dot and slash at the beginning?
I use CentOS 6.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
unalias zzz
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
none of these methods require root access !!!!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should NEVER add "." to the path, especially at the front, as that can lead to a security vulnerability. It would be simple for anyone to place a script into a location that you might go to (such as /tmp), give it a name such as "ls", and if you changed to that directory and run "ls", you would run that script with your user's permissions.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER