LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-16-2006, 10:01 PM   #1
naihe2010
Member
 
Registered: Oct 2005
Location: China
Distribution: ArchLinux
Posts: 103

Rep: Reputation: 15
How to solve this problem in terminal?


I often use shell script to do some work.
But, I find some problem in my slackware system.

For examble, I have 3 files in cureunt directory.
Code:
 
$ ls 
$ file1 file2 file3
But, if I echo the output in a file, like:
Code:
 
$ ls > file
When I vi the file, I will find the file name is like this:
Code:
 
$ vi file 
^[[00m^[[00mfile1^[[00m 
^[[00m^[[00mfile2^[[00m 
^[[00m^[[00mfile3^[[00m 
^[[m 
~
So, I can't use this in my shell script.
How to solve this problem?
 
Old 08-16-2006, 10:46 PM   #2
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
I can't say for sure but it looks like a language setting.
This may or may not work, but try this code and see if the problem goes away.
Code:
$ LANG=C ls >file
$ vi file
 
Old 08-17-2006, 11:13 AM   #3
soggycornflake
Member
 
Registered: May 2006
Location: England
Distribution: Slackware 10.2, Slamd64
Posts: 249

Rep: Reputation: 31
These look like colour formatting codes, try

Code:
ls --color=none > file
 
Old 09-08-2006, 03:27 AM   #4
naihe2010
Member
 
Registered: Oct 2005
Location: China
Distribution: ArchLinux
Posts: 103

Original Poster
Rep: Reputation: 15
When I use
Code:
ls --color=auto
or
Code:
ls --color=none
, It 's OK.
 
  


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
trying to solve a problem... kiasta Linux - General 5 06-28-2006 06:36 PM
help..how i can solve this problem?// TAAN Linux - General 2 02-16-2005 07:53 AM
Who can help me to solve this problem? Annie0716 Programming 2 08-09-2004 07:59 PM
I don't know how to solve a problem in C nostrum Programming 5 07-20-2004 07:57 AM
No one can solve my problem Sundance Linux - Newbie 5 12-08-2003 01:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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