Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

compiling programs

Posted on 1998-10-24
5
Medium Priority
?
213 Views
Last Modified: 2010-04-20
how can I compile/run script that look LIKE
echo "Blah Blah. "
mv /home/users/ciris /home/ciris
rm /home/users/ciris/file
echo "finished."
?
0
Comment
Question by:ciris
  • 3
  • 2
5 Comments
 
LVL 19

Expert Comment

by:xterm
ID: 1638352
Compile it?   You don't need to compile anything - your
script is ready to go.  Just put the line "#!/bin/sh" at
the top of a new file, enter your 4 lines below that, and
save it.

Then "chmod u+x filename" and run it with "./filename"
(or you can type "sh filename")
0
 

Author Comment

by:ciris
ID: 1638353
if I name it blah, how can I get it to be executed (in that directory only) as blah, not ./blah?
0
 
LVL 19

Accepted Solution

by:
xterm earned 400 total points
ID: 1638354
Well, you could add "." to your path by doing:
export PATH=$PATH:.

.but it is recommended generally that you do not login
as root with "." in your path (although the risk of being
trojaned with that being the last item in your path is
minimal).

An example would be if a user put a file called "ls" in his
home directory that contained "rm /etc/passwd" - you get the
idea, I'm sure.
0
 

Author Comment

by:ciris
ID: 1638355
deleting the password file would delete the passwords, right? would this work with a shadowed password?
0
 
LVL 19

Expert Comment

by:xterm
ID: 1638356
No, you'd have to delete /etc/shadow too - that wasn't my
point.  My point was that horrible things can happen if an
unsuspecting admin had . in their path & they had some
malicious shell users.  
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question