Newbie needs help with simple script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Newbie needs help with simple script
# 1  
Old 02-24-2006
Newbie needs help with simple script

Hi, I'm just new here, looks like there is alot to read.


I need some help on a simple script that i would like to make, and I honestly have zero experience with shell scripts or anything, so i have no idea what I am doing.



I want to have a script that I can upload to to my webhosting account, and then login via shell and run the script.

I need the script to copy two files from different folders, to a folder that I input. Then I need it to rename the two files.

So basically, i need the script to ask me what folder i want it to copy the files to, then i type the folder i want, then it copys the files and renames them.


I tried making the script myself, but failed, no surprise there. Here is what i made, feel free to laugh Smilie

Code:
#!/bin/bash

echo -n "Choose your domain folder > "
read folder


mk dir $folder/cgi-bin

cp php/bin/php $folder/cgi-bin
cp php-4.3.0/php.ini-recommended $folder/cgi-bin

mv $folder/cgi-bin/php $folder/cgi-bin/php.cgi
mv $folder/cgi-bin/php.ini-recommended $folder/cgi-bin/php.ini

Any help would be appreciated.
# 2  
Old 02-25-2006
It is mkdir
all one word

Other than that, if you have the paths right, it looks good.
# 3  
Old 02-25-2006
ok i changed that,

it is saying ":bad interpreter: No such file or directory" when i try to execute the script.



I have tried /bin/bash, /usr/bin/bash, /bin/sh, /usr/bin/sh

nothing works.
# 4  
Old 02-25-2006
Post the output from:
uname -a
which bash
which sh
which ksh
echo $SHELL
ps -f
cat /etc/shells
# 5  
Old 02-25-2006
Quote:
Originally Posted by shizizzle
ok i changed that,

it is saying ":bad interpreter: No such file or directory" when i try to execute the script.



I have tried /bin/bash, /usr/bin/bash, /bin/sh, /usr/bin/sh

nothing works.
for that perticular problem,

Code:
mkdir -p  $folder/cgi-bin

# 6  
Old 02-27-2006
Quote:
Originally Posted by Perderabo
Post the output from:
uname -a
which bash
which sh
which ksh
echo $SHELL
ps -f
cat /etc/shells
Here are the results....this is driving me crazy.

uname -a
Linux sunset 2.4.29-grsec+w+fhs6b+gr0501+nfs+a32+++p4+sata+c4+gr2b-v6.189 #1 SMP Mon Feb 7 13:23:30 PST 2005 i686 GNU/Linux

which bash
/bin/bash

which sh
/bin/sh


which ksh
/usr/bin/ksh

echo $SHELL
/bin/bash

ps -f
UID PID PPID C STIME TTY TIME CMD
user 10611 32121 0 10:35 pts/6 00:00:00 -bash
user 17219 10611 0 10:38 pts/6 00:00:00 ps -f

cat /etc/shells
# /etc/shells: valid login shells
/bin/ash
/bin/csh
/bin/sh
/usr/bin/es
/usr/bin/ksh
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/zsh
/bin/sash
/bin/zsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/screen
/etc/ftponly
/bin/ksh93
# 7  
Old 02-27-2006
Then /bin/bash should have worked. The first line of a script must look exactly like this:
#! /bin/bash
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

2. Shell Programming and Scripting

Shell script newbie, what is problem with my script?

Hello, Ubuntu server 11.10 can anybody help what is problem with my shell script? #!/bin/bash #script to find out currently logged on user is root or not. if ] then echo "You are super" else echo "You are awesome!" fi When I run script, I get following output ./uid: line 3: I... (4 Replies)
Discussion started by: kaustubh
4 Replies

3. Shell Programming and Scripting

please help newbie with script

hi!i am musician and have very little knowledge about shell here's my script #!/bin/bash for (( ; ; )) do wget some wikipedia article here --output-document=- > /dev/audio done so it downloads random wikipedia page (forum doesnt let me post link so i wrote some wikipedia article here... (6 Replies)
Discussion started by: karlhungus
6 Replies

4. UNIX for Dummies Questions & Answers

Need help with simple Linux commands - NEWBIE here!

Hey guys, I need help with simple unix commands. I'm a newbie to Unix and don't know these commands. Any help is appreciated. 1. Logon to Linux. 2. Create a directory "Unix" under your home directory. Command(s): …………………………………………. 3. Create four... (1 Reply)
Discussion started by: loverangerguy
1 Replies

5. OS X (Apple)

Newbie Backup Script

Hello All, I have attempted to write my first complex (to me) backup script. I am offering it to any and all who may find it useful but would like to refine it as well. I'm using it to backup a Mac OSX Lion Server to a USB Raid5. The script is actually comprised of a daily and a weekly script... (3 Replies)
Discussion started by: dbol
3 Replies

6. Shell Programming and Scripting

simple problem for a newbie

I am trying to find a way to display just sudoers, passwd and shadow files without the extensions.. Thank you for any suggestions ls -lrt /etc | egrep 'sudoers|passwd|group|shadow' -r-------- 1 root root 1338 Oct 31 2006 shadow.sav -r-------- 1 root root 5191... (4 Replies)
Discussion started by: delphys
4 Replies

7. Shell Programming and Scripting

Shell Script Help -I'm a newbie

Can someone help me write this shell script? I am completely new to shell and as a fun task my uncle has challenged me a problem (out of all other people). Basically, all he wants me to do is to create backup file in a folder that is named “disables.” This is what he said: create a shell script... (0 Replies)
Discussion started by: hotcutiepie05
0 Replies

8. Shell Programming and Scripting

Newbie problem with simple script to create a directory

script is: dirname= "$(date +%b%d)_$(date +%H%M)" mkdir $dirname should create a directory named Nov4_ Instead I get the following returned: root@dchs-pint-001:/=>./test1 ./test1: Nov04_0736: not found. Usage: mkdir Directory ... root@dchs-pint-001:/=> TOO easy, but what am I... (2 Replies)
Discussion started by: gwfay
2 Replies

9. Programming

newbie to unix programming in C, needed a few simple prgs on these functions!

Hi all, I am a newbie to unix programming using C.. So i would like to have a few simple C programs to start off with.. I wanted programs on learning , abort,kill and raise,alarm and pause,I would also like to know how to use the vfork() in a prg It would be really great if i can have... (1 Reply)
Discussion started by: wrapster
1 Replies

10. UNIX for Dummies Questions & Answers

Simple newbie grep question

How come grep testfile1 won't find anything in testfile1 (even though the characters sd are there in great quantity), but grep '' testfile1 will find plenty? Do the single quotes prevent the shell from interpreting the testfile1 is interpreted as: grep *test whether or not characters sd exist*... (5 Replies)
Discussion started by: doubleminus
5 Replies
Login or Register to Ask a Question