LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-30-2007, 04:04 PM   #1
mike_stlouis
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Rep: Reputation: 0
bash script does nothing....


this script does nothing... is my sentax wrong for executing this line of code in every file in the current directory? when i run the iconv line of code by itself from the command line for one file it works fine.
the script and files are in the same directory and i call it by typing:
./conversion_script.sh
# what gives? thanx in advance! it gives no errors.
# i have writes to execute this,
# and i ran: mv file.txt file.bak; tr -d '\r' < file.bak > file.txt
# where file.txt was replaced with conversion_script.sh

#!/bin/bash

for filename in "$@";
do
iconv -f utf-16 -t utf-8 "$filename" > $filename-new
done
 
Old 10-30-2007, 04:09 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
You didn't provide a filename blob. For example:

./conversion_script.sh *.txt
 
Old 10-30-2007, 04:23 PM   #3
rsashok
Member
 
Registered: Nov 2006
Location: USA, CA
Distribution: RedHat, Debian
Posts: 202

Rep: Reputation: 31
I suggest to debug it by adding echo to the line:

Quote:
#!/bin/bash

for filename in "$@";
do
echo "iconv -f utf-16 -t utf-8 $filename > $filename-new"
done
Then you could see your filenames
 
Old 10-31-2007, 07:55 AM   #4
mike_stlouis
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Original Poster
Rep: Reputation: 0
thanks both of you!

thanks, it worked.
 
  


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
passing variable from bash to perl in a bash script quadmore Programming 6 02-21-2011 04:11 AM
Bash script to create bash script jag7720 Programming 10 09-10-2007 07:01 PM
[bash] having trouble debugging this bash script. jons Programming 4 02-08-2007 06:51 AM
Bash script hangs upon starting another script in the background masea2 Linux - Software 4 11-13-2006 05:18 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:25 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