Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

compiling programs

Posted on 1998-10-24
5
Medium Priority
?
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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

705 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