Linux Scripting Help Needed

Talk about whatever topic you'd like, RPG related or not. (But please discuss things related to our software in the Tools section, below.)

Moderators: dorpond, trevor, Azhrei

User avatar
Mr. Pokeylope
Giant
Posts: 118
Joined: Mon Aug 11, 2008 9:24 pm

Post by Mr. Pokeylope »

Orchard wrote:The truth of the matter is quite simple though; emacs, vi, vim and other context sensitive text editors from unix are rather arcane, and you needed to learn a lot of very unintuitive commands to be able to accomplish the simplest of tasks with very minimal user feedback. I am very glad that more userfriendly programs exist, and see no reason to go back to something more arcane.
I personally use vim. The tradeoff for having to learn to use an editor like vim or emacs is that they're extremely powerful, and once you know your way around you can do things very quickly and efficiently. I write code for a living (and thus spend all day editing text) and so for me the tradeoff is worth it. For other people it's not, and so yeah, it's great that there are other easier-to-learn editors out there.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

I appreciate that for someone who does a lot of text editing a tool like vim can be very useful, but I use things like scite/scintilla, and have used various IDEs and find that they are very powerful as well, and have the benefit of more visual feedback to me, which improves my productivity.

If you don't need that, great. But I do.
0+0=1, for very unstable CPUs.

User avatar
Steel Rat
Great Wyrm
Posts: 1765
Joined: Tue Jun 13, 2006 5:55 pm
Location: Oak Harbor, WA
Contact:

Post by Steel Rat »

The truth of the matter is quite simple though; emacs, vi, vim and other context sensitive text editors from unix are rather arcane, and you needed to learn a lot of very unintuitive commands to be able to accomplish the simplest of tasks with very minimal user feedback. I am very glad that more userfriendly programs exist, and see no reason to go back to something more arcane.
This was the crux of it for me. I use it so very seldom I needed something that didn't require paranormal abilities to "just know the commands" to use.
Steel Rat
-----------
RPGMapShare.com - RPG Maps and Mapping objects.
Discord Server

User avatar
jstgtpaid
Giant
Posts: 142
Joined: Sun Jun 22, 2008 1:23 am
Location: Tampa, FL

Post by jstgtpaid »

I agree completely with Orchards statements. New tools are better, I believe. However, I often find myself on the command line at work and sometimes at home; so I am glad I did take the time to learn vi.
When the boogeyman goes to bed everynight, he checks his closet for Chuck Norris.

User avatar
syntruth
Giant
Posts: 241
Joined: Mon Aug 18, 2008 7:15 pm
Location: Michigan, USA

Post by syntruth »

xD! Funny...

Reason to use vi: Sometimes, it's all you're given. Seriously, some old school unices only came with vi. Some of the Sun boxes in our head-end only have vi. (Ahh, I wish I was still in that department; I'll take using vi on any unix vs. installing printer drivers for Vista. >.> [cough]) There were a few times I really needed to change a config and vi was all there was. It's the only reason, I might add, that I know vi at all actually.

Vi is darn powerful, though, but it's like magic: to become a master mage, it takes lots of learning, practice, and burning your fingers a few times.

Emacs? C'mon, kitchen sink. 'Nuff said.

I'm a firm believer in the right tool for the job, most of the time for me, that is nano, unless I need heavy-duty search and replace, then I'll break into vim. When I am writing (as in, fiction writing) I am using ne (As in "nice editor" -- should be in most distro's package tree.) If you have never heard of it, give it a try. -Great- command line text editor, complete with macros. I'm slowly moving over to ne for coding too, actually.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Post by Azhrei »

On many Unix systems, if your machine blows up and you're responsible for the recovery process, often vi is the only available editor on the recovery CD. It's not important that the user be an expert, but they should at least be able to move around and do simple edits. If nothing else, the only commands you need are dd, i, and a. Everything is icing.

Of course, if you spend much time in the editor, the other commands will save a BUNCH of time. But they require more of a time investment up front in order to reap those rewards later.

And if you get good at vi, you can turn on the vi command line editing features in Bash and Ksh (use set -o vi) allowing you to use the same keystrokes to edit command lines that you use inside your editor. That gives a big boost to productivity...

Most people are told to learn an editor by being given a cheat sheet and being told, "Here. Memorize this." Yeah, great. That's a super way to learn an editor. Not.

All vi commands are "operators" and "operands", except for a few that don't fit the paradigm. Operators specify the manipulations you want to make (delete, insert, change, ...) and operands specify the amount of text to modify (word, sentence, paragraph, ...).

So "d" for delete and "w" for word means to delete one word. This is so simple that a user only needs to learn a half-dozen operators -- I recommend d(elete), i(nsert), a(ppend), c(hange), o(pen), and r(eplace). Then learn a few operands -- h-j-k-l for left-down-up-right, W for next word, E for end of word, B for back one word, and "/" to perform a regex string search. Some commands don't fit the paradigm: u(ndo), .(redo last change), and Ctrl-L (redraw screen). And you will need the ":" commands since they handle all file input and output operations, like reading in other files or saving the current file.

Visit http://www.eeconsulting.net/ and scroll down to the Downloads link and click it. Towards the bottom of the next page is a link to my vi cheat sheet which describes this in more detail. Or if you Google for "vi cheat sheet", my page is in the top five or six hits (but it's the EEC.COM domain).

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

My thing is this: yeah if I'm on a command line, and ALL I have is vi/vim, great, I would want to know how to use it. BUT if I am on a command line and I all I am doing is making a few simple edits because screwed up two characters on a config file, then give me nano. I want to get my computer booting fast. I don't use vi/vim often enough to remember the commands.

But once I have a graphic interface, I'm not going to use a command-line editor for text. I have two tools that I use for text editing when I need POWERFUL find/replace and regex utility within a single file (if I need more than that, then I'll start thinking about a script, but it's pretty rare). That's Notepad++ (which is good for 99% of what I need, but lacks a couple of options) and Scite/Scintilla (which does a replace in selection that Notepad++ seems to lack). Both support regex stuff, and do fairly complex find/replace commands appropriate for working within a single text file.

Are they perfect? Not at all. But both also recognize code syntax and highlight various scripting language syntax for me (including css/html), and that's a benefit I'm not really crazy about getting rid of. They aren't full-feature ide's, but they are VERY lightweight.

I won't argue that vi/vim are very useful for certain things, but once I have a gui, no thanks. Emacs? Not my ball of wax. If I need an operating system in a text editor, I know things are a bit wonky.
0+0=1, for very unstable CPUs.

Big_Mac
Dragon
Posts: 631
Joined: Thu Aug 17, 2006 10:37 am
Location: Brockton, MA
Contact:

Post by Big_Mac »

I like VI for many of the reasons Azhrei listed. I like it so much that I have 2 licenses for a windows based VI editor. It gives some decent yet basic code hi-lighting. I use it for all of my text file that may need to be edited.

My reason for that type of editor is that I am way more efficient with it. I like keeping my hand on the keyboard and not jumping over to the mouse to do something.
--
Big Mac

User avatar
syntruth
Giant
Posts: 241
Joined: Mon Aug 18, 2008 7:15 pm
Location: Michigan, USA

Post by syntruth »

I use notepad++ at work. It's the one, free Windows editor that is really nice, actually. I do cheat and convert TextMate themes over, but overall, it beats the crap outta most other editors I've tried on Windows.

The fact that it can do split window? Win.

User avatar
Steel Rat
Great Wyrm
Posts: 1765
Joined: Tue Jun 13, 2006 5:55 pm
Location: Oak Harbor, WA
Contact:

Post by Steel Rat »

Uh oh, you said the "W" word in a Linux geek discussion!
Steel Rat
-----------
RPGMapShare.com - RPG Maps and Mapping objects.
Discord Server

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

Steel Rat wrote:Uh oh, you said the "W" word in a Linux geek discussion!
Actually that's two people that have...

the gall!

To be honest, though, I don't use linux as much as I'd like to.

Maybe its because I got tired of trying to get my wireless network to actually function. Or because I still need SPSS (stats).

Or because I actually like MS Office 2007. I still think that OpenOffice3 is making a HUGE mistake by not allowing user-interface hacking so that someone can create a clone/near-clone of the ribbon. The ribbon (to me) is one of the BEST user-interface design decisions that microsoft has EVER come up with. I maintain that Office 2007 is their best product currently.

Would I rather be running linux? Oh sure. But I just haven't had the time to get things going in linux recently. I keep telling myself 'soon'. Then it doesn't happen.
0+0=1, for very unstable CPUs.

Post Reply

Return to “General Discussion”