LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-21-2006, 07:39 AM   #1
bhuwan
LQ Newbie
 
Registered: Jan 2006
Posts: 11

Rep: Reputation: 0
linux script question: data


Code:
 -bash-3.00$ more cs
#!/bin/sh
date=$(date +%F)
filename=$date
mysqldump --opt -Q -u N -pmanager N | gzip -9  > "dir/here/private/backup/proj_$filename.sql.gz";
Code:
-bash-3.00$ bash cs
: command not found
-bash-3.00$
first of all, why is it out putting "command not found"
MORE IMPORTANTLY, why does the output contain some useless characters?
output:
Code:
-bash-3.00$ ls
proj_2006-02-21??.sql.gz
notice the "??"
 
Old 02-21-2006, 08:39 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
To run a script, it must be executable (chmod 755 filename)

To execute a file, the path needs to be in the PATH variable. Otherwise, you need to specify the path, like so:
./filename
OR
/fullpath/filename

Can't help you on the ??
 
Old 02-21-2006, 09:16 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
To run a script, it must be executable
...or supplied on cmdline: shell <filename>.


notice the "??"
If you run "stat -c %N" on the filename, what does it say?
 
Old 02-21-2006, 11:14 AM   #4
bhuwan
LQ Newbie
 
Registered: Jan 2006
Posts: 11

Original Poster
Rep: Reputation: 0
the file runs okay, so it doesnt seem as if it is a chmod problem -- i think all these enters (added through windows) is confusing the script --

Code:
-bash-3.00$ stat -c %N rs
`rs'
-bash-3.00$
i redid the script via unix 'vi' and i no longer have problems with the "??"'s being added in the name - I wonder what was the cause (I edited the script in Windows yesterday)?

Regardless, my problems are solved, so thanks everyone!

Last edited by bhuwan; 02-21-2006 at 11:15 AM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Location for script data storage Skazi Linux - General 1 10-15-2005 09:55 AM
A simple Linux script question I'm sure Tap-Out Programming 4 07-23-2005 02:11 PM
Script to get form data..in bash? jrfly Linux - General 1 06-29-2005 10:04 AM
Burn Data DVD... Read Data in Linux and Windows SaintStrive Linux - Newbie 3 09-18-2004 05:04 PM
Question about Bash script for Linux Linh Programming 9 04-21-2004 11:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:00 AM.

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