LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-06-2013, 08:08 PM   #1
fhleung
Member
 
Registered: Aug 2004
Distribution: Fedora, Debian
Posts: 354

Rep: Reputation: 30
tidy up script, code or file -- Any command can do?


I am having Centons 6. I got a simple request that many other programmers may interested too.

I would like to TIDY UP like LINE UP the
brackets of if, else, for, while

I'd like to read the code easily. Any Linux command can do this?


Code:
if(){
          for ($i=0; $i<$variable; $i++) {
    }

}else      {

   }

Last edited by fhleung; 05-06-2013 at 08:15 PM.
 
Old 05-06-2013, 08:46 PM   #2
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,792

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Most IDEs (e.g Eclipse) can do this. There are also program like this: http://astyle.sourceforge.net/
 
Old 05-06-2013, 09:25 PM   #3
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,171

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
You might want to look at astyle.

jlinkels
 
Old 05-06-2013, 10:21 PM   #4
fhleung
Member
 
Registered: Aug 2004
Distribution: Fedora, Debian
Posts: 354

Original Poster
Rep: Reputation: 30
http://beta.phpformatter.com/
 
Old 05-07-2013, 01:55 AM   #5
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,589

Rep: Reputation: 1942Reputation: 1942Reputation: 1942Reputation: 1942Reputation: 1942Reputation: 1942Reputation: 1942Reputation: 1942Reputation: 1942Reputation: 1942Reputation: 1942
Vim may possibly be clever enough if you have the right formatting invoked.
 
Old 05-07-2013, 11:11 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
For C code, the usual standard is indent. It has options to achieve almost any standard that you prefer.
--- rod.
 
  


Reply


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
How to filter the linux kernel code based on config file. removing unnecessary code atulmt Linux - Kernel 4 06-29-2013 11:14 PM
Tidy shell script source file mmn357157 Linux - General 8 12-20-2008 07:33 PM
Tidy exit in C mykaitch Programming 11 03-23-2007 03:18 AM
Tidy? Which version to get and how? the_gripmaster Linux - Software 2 03-02-2007 01:37 AM
DISCUSSION: Tidy Up With HTML Tidy jeremy LinuxAnswers Discussion 0 10-10-2005 07:25 PM


All times are GMT -5. The time now is 06:16 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration