The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remove trailing G Heathe_Kyle Shell Programming and Scripting 3 04-14-2008 07:56 AM
shortcut for tar cvf - [filename] | gzip > [filename].tar.gz bcamp1973 UNIX for Dummies Questions & Answers 4 12-11-2007 02:45 PM
~mark henk Shell Programming and Scripting 1 04-23-2006 06:12 AM
? question mark, how to get back to the root directory etravels UNIX for Dummies Questions & Answers 1 02-05-2004 03:14 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-07-2006
Registered User
 

Join Date: Jun 2006
Posts: 1
trailing question mark in filename

I have a script(ex.sh) with one line in it, running in bash shell.

ls -l > /usr/ngasi/contexts/tdevoe/private/ex.txt

when I run it , it creates the file with a trailing question mark

-rwx------ 1 tdevoe webapp 59 Jun 7 06:42 ex.sh
-rw------- 1 tdevoe webapp 3761 Jun 7 06:42 ex.txt?

why?
Reply With Quote
Forum Sponsor
  #2  
Old 06-08-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 989
I think you've got gremlins.



"Gremlin" is a colorful term for strange, nonprinting characters that your text editor might not show you but can really foul things up anyway. That's not a literal question mark, it's ls thinking "What the hell is that? I can't print that!" so it just prints a question mark instead. Gremlin characters are even more annoying in C files, the compiler just dies.

I often get lots of gremlins from copy/pasting stuff from the internet. If that's how you ended up with that one, there's probably lots more.

You can get rid of gremlins like:
Code:
tr -d '[\000-\010\014\016-\037\177]' < messed-up.sh > fixed.sh
This will strip out any characters but ASCII printing characters, newline, carriage return, tab, and space.

P.S. Don't feed them
Reply With Quote
  #3  
Old 06-09-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
A lot of editors have a hex display mode. I use Ultra Edit for finding embedded junk characters, and dos2ux to clean up files brought over from Windows systems.
Reply With Quote
  #4  
Old 06-09-2006
Registered User
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
You could try "ls -b" to display any gremlin characters in octal notation (\nnn)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0