5 ms·
PowerShell is a little bit more difficult then something like Python or a well equipped Bash shell, but the fact that you can do it shows how much progress it h
by dkhenry 9y ago
PowerShell is a little bit more difficult then something like Python or a well equipped Bash shell, but the fact that you can do it shows how much progress it has made
- IshKebab 9y agoI would say nothing is much less intuitive than a Bash shell. Maybe the Git CLI. But Bash is spectacularly unintuitive. How do I rename files? `mv`? List files is `ls`? Why not `list`? What the hell does `2>&1` even do?! Have you ever looked at the escaping options of `ls`? How do I end a for look? `fi`? WTF kind of a weird joke is that? If you're thinking "but... it's all so obvious. What is this guy talking about", ask yourself how long ago you first typed a shell command. Can you even remember how hard it was to learn? For me it was something like 15 years and I actually can remember because it made such an impression on me how terrible a system it was. (That and X86Config if you remember that insanity.) Even though it was awful to learn, it feels totally easy and 'intuitive' to me now. But that's just because I use it so much. It's not intuitive. Don't fall into the old curmudgeon trap of thinking the thing that you find trivial through experience is actually good. /rant
- jrochkind1 9y agoMaybe it's intuitive compared to whatever else there was in the 70s when the bourne shell was invented? I dunno. I agree, bash is not very intuitive to the contemporary scripter _especially_ when you get into scripting.
- lottin 9y agoWhat were you using before? Compared to DOS the Unix shell actually seemed a very well designed system. There are a couple of things that are admittedly hard to grasp, redirection being one of them. But I have no problem with mv and ls. By the way, fi closes an if block. A for loop uses do and done.
- richfnelson 9y agoIn DOS you use `dir` to list files in a directory. You can also use `dir` to list files that match a string in a directory. `dir 1.png` would list all PNGs with a "1" in their name. You need a separate command with options and a flag to do that in bash. In DOS, it's less than a dozen characters, and it's far more intuitive than having to use `find`. Sure, `find` and `ls` might be more flexible, but definitely not more intuitive.
- userbinator 9y agoYou need a separate command with options and a flag to do that in bash. No you don't; whether ls is a builtin is mostly irrelevant, but ls *1*.png does exactly what you (I assume) are saying, dir *1*.png which AFAIK is a new extension introduced with WinNT's command processor, since the old algorithm... https://blogs.msdn.microsoft.com/oldnewthing/20071217-00/?p=24143 https://blogs.msdn.microsoft.com/oldnewthing/20071217-00/?p=... ...would effectively produce a pattern matching all files ending in '.png'.
- sebcat 9y agousing ls with globbing is redundant: the shell will expand * 1* .png to a list of files, which will then be passed to the argument vector of ls, looking up the files twice. You could just do echo * 1* .png. ls doesn't do glob matching. ls '*' would try to fstatat (FreeBSD) that character. EDIT: formatting
- JdeBP 9y agoThis use of the word "new" is a bit of a stretch. Consider that the "new" wildcard algorithm has been around for as long as Linux has. Possibly longer, although I'd have to check when 4DOS and 4OS2 started providing extended wildcards.
- throwaway7645 9y agoDoes DOS have anything like "locate x"? Or do you have to use the horribly inefficient graphical search which takes AGES. The Unix terminal takes a little while to learn, but it is powerful. Windows is mind-numbing.
- cesarb 9y ago> But Bash is spectacularly unintuitive. [...] Can you even remember how hard it was to learn? From what I recall, it was easy. Other than a few small differences ("mkdir" instead of "md", needs a space between the "cd" and the "..", and so on), it was similar to what I used every day. The rest I learned gradually, by reading shell scripts written by other people, and the man and info pages. As for XF86Config, I always used the XF86Config generators which came with the distributions, so it was never much of a problem for me.
- nilved 9y agoI'll the first to admit that bash sucks, but the only thing you mentioned that is part of bash is `2>&1`.
- userbinator 9y agoCan you even remember how hard it was to learn? I can remember when I first learned bash/sh and Unix systems in general (by reading a book) and it was not really hard. However, I saw your sentiment a lot among the students I used to teach, and my response has always been "you're approaching it the wrong way." Bash, PowerShell, etc. are effectively programming languages, and my advice for learning programming languages applies: it's a language. To elucidate, programming languages have their own vocabulary and rules just like a human language (and often, the rules are far more consistent and the vocabulary smaller) --- to ask questions like "Why not `list`?" is like asking "Why is the plural of sheep, sheep? Why is it called a mouton in French? Why not sheepe?" Of course, you can ask such etymological questions when learning about programming languages and use them to help you, because they will have far more logical answers than the same questions about human languages; but in general, learning a language as a language is the best way to progress. In fact I'd say super-verbose and somewhat convoluted languages like PowerShell (and C#, which I don't fancy much either --- nor its Java-ish ancestry, for that matter) may only appear to be more intuitive at first, but are actually hiding some quite nonintuitive complexity. The verboseness may make it easier to get started, but becomes a hindrance thereafter. /rant
- skynode 9y ago> In fact I'd say super-verbose and somewhat convoluted languages like PowerShell (and C#, which I don't fancy much either --- nor its Java-ish ancestry, for that matter) may only appear to be more intuitive at first, but are actually hiding some quite nonintuitive complexity. The verboseness may make it easier to get started, but becomes a hindrance thereafter. Some historical syntax ancestry aside, state-of-the-art C# is too classy and elegant to be in the same sentence with Java.
- erikbye 9y agoModern C# seems confused about what it is. I think a lot of stuff should exist exclusively in F#. And C# is just as bureaucratic in nature as Java.
- 9y ago
- ams6110 9y ago> But Bash is spectacularly unintuitive. How do I rename files? `mv`? List files is `ls` mv and ls are not shell commands, they are programs. They existed long before bash and were developed at a time of 110 baud teletype connections when short, highly abbreviated command names were worth the inconvenience. If you don't like them you're free to alias "rename" to "mv" and "list" to "ls"
- skynode 9y agoBash was spectacularly intuitive while I was learning it. And err, ending a conditional `if` statement with `fi` is probably one of the most intuitive linguistic constructs ever in CS; no need to analyze whether we should end it with `end`, `finish`, `done` or (worse) `terminate`.
- IshKebab 9y ago`end` is pretty much universally used to end blocks in 'wordy' programming languages. Are you seriously suggesting that `esac` is more intuitive than `end`? Cute, perhaps, but not intuitive. "How do you end this block? Maybe... I type 'end'? Nope! You write the opening statement backwards! Ha ha get it? Backwards lol!"
- Aloha 9y agoUsing bash at a high complexity level is like going thru a unix archeology expedition every time you sit down.
- erikbye 9y agoAnd few things are as rewarding as an Unix expedition. If these management people at work used awk instead of Excel for some of the things.... man, they'd save hundreds of hours in just a month.
- darklajid 9y ago> How do I end a for look? `fi`? done?
- erikbye 9y agowe use POSH extensively at work and I haven't seen a single person not using the built-in Unix aliases. Even the TIER 1 peeps got it. Also, there's a story behind all these commands, their naming, the symbols, reasons for the brevity. But I've never not found Unix intuitive, even before I was aware of the reasoning behind everything. That said, Unix is definitely an environment for the more savvy. But what's intuitive for me is not necessarily intuitive for someone less savvy.
- YeGoblynQueenne 9y ago>> What the hell does `2>&1` even do?! It redirects standard error to standard out? That's what it does in powershell anyway. Frex, I got this line in my $PROFILE: $p2 = & $env:Python_2/python.exe --version 2>&1 To get the current Python 2 version on my machine. I'm not really sure what it's an alias for, but I like having the shortcut of the more concise syntax. The real problem is that, for some reason, python.exe --version outputs to standard _error_. That, I don't really get. I'm sure there's a good reason for it but it's not obvious and that's what's making the "2>&1" at the end hard to figure out.