LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-13-2006, 01:12 PM   #1
Zaiachkowski
LQ Newbie
 
Registered: Jun 2006
Posts: 1

Rep: Reputation: 0
Script Refuses to Work.


Script I Wrote refuses to work and I dont know why?

#!/bin/sh tar -Pvcf ../`uname -r`/`date "+%m%d%y.tar."` --exclude /tmp --exclude /var/run --exclude /dev --exclude /backup $* /
 
Old 06-13-2006, 02:16 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Please post *exact* errors instead. It's much more efficient.
If you have script problems the first thing is to run it in debug mode.
With values expanded there's more chance you see where the error is at.
 
Old 06-13-2006, 02:33 PM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Your interpreter line and your command line should be separate:

Code:
#!/bin/sh 

tar -Pvcf ../`uname -r`/`date "+%m%d%y.tar."` --exclude /tmp --exclude /var/run --exclude /dev --exclude /backup $* /
As unspawn indicated you should give your errors when asking questions as it helps to debug. I'm sure the above is an issue but may not be your only one.

The "#!...." is special syntax as first line of a shell script that tells it what interpreter (shell, perl, other...) to use to execute what follows that line.
 
Old 06-13-2006, 02:58 PM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I would work with the filename and just echo it to get that working, then put it in the tar script. I don't think using a / in the filename is a good idea and underscore may be a better choice.

Code:
#!/bin/sh

filename=$(uname -r)'/'$(date '+%m%d%y').tar.gz
echo $filename
Code:
#!/bin/sh

filename=$(uname -r)'/'$(date '+%m%d%y').tar.gz
tar -Pvcf $filename --exclude /tmp --exclude /var/run \
--exclude /dev --exclude /backup $* /
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gimp refuses to work JeTa Linux - Software 1 06-15-2005 12:45 PM
su command refuses to work lithiumfx Slackware 16 04-16-2005 05:20 PM
yum refuses to work arjun_sh Linux - Newbie 4 03-19-2005 06:52 AM
Audio refuses to work :( DaBlade Linux - Hardware 47 10-10-2004 05:31 PM
XV refuses to work snooo Linux - Software 14 08-12-2004 06:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration