Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-30-2007, 05:04 PM   #1
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:
# 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


for filename in "$@";
iconv -f utf-16 -t utf-8 "$filename" > $filename-new
Old 10-30-2007, 05:09 PM   #2
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:

./ *.txt
Old 10-30-2007, 05:23 PM   #3
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:


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

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

thanks, it worked.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

All times are GMT -5. The time now is 09:48 PM.

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