Advertisement

07.16.2008 at 02:16PM PDT, ID: 23571354
[x]
Attachment Details

Creating a simple bash script that asks the user for a destination filename

Asked by Simon336697 in Bourne-Again Shell (bash), Perl Programming Language

Hi guys, hope u r well and can help.

I want to create a simple bash script that does the following..

When run, eg. newfile.sh,

1) Prompts the user for a destination filename
2) Does a cp of a file located in /templates/ of /templates/menu2_x_x.php
3) Copies the file to /new/
with the new file being what the user has typed in at the prompt.

So, the  sequence is:

#newfile.sh
[Please Enter new filename]         <Script Prompt>

menu2_it_test.php       <User Entered>

--------------------------
Result is:

New file created in /new as
/new/menu2_it_test.php

which is a copy of /templates/menu2_x_x.php

Any help greatly appreciated.

Id like to do this in a bash script and not with perl if that is okay :>) Thank you.Start Free Trial
[+][-]07.16.2008 at 03:31PM PDT, ID: 22020784

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Bourne-Again Shell (bash), Perl Programming Language
Sign Up Now!
Solution Provided By: Tintin
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.16.2008 at 03:47PM PDT, ID: 22020879

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628