GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing bashfulbytes.com — $_Bashful Bytes
2016-09-04
research
BASH: What Needs to Go, What Needs to StayWhat Is the Problem?First, let's go through some typical sources of frustration with Bash. WhitespaceBash programmers know that spacing matters: If statements: The reason for this is that Bash divides each line into words, delimited by each whitespace. The first word is seen as the name of the command to be executed, while the following words are the arguments to that command. So, in the variable assignment above, Bash thinks that Same goes for the if statements: One slight note about WordsplittingAnother common source of error and frustration: wordsplitting. Bash uses parameter expansion, replacing variables with their values, to be able to access the data stored in variables. Without double-quoting, wordsplitting occurs in the expansion (new words will be created at every whitespace). Take the following example: Output: All thanks to wordsplitting. Add double-quoting: Output: In a larger example, take this file, named Consider these commands: Output: Output: TestA discrepancy in Bash that also leads to ambiguity (*frustration)
is new test ( Child SubshellsHave you ever tried to edit a global variable inside of a function?
Or inside of any other action that results in the creation of a
subshell? Did it work out? Command SubstitutionHaving two ways to execute commands,
and
is not clear and adds ambiguity to programs. These two commands are
the same:
What Is the Solution?In a new language, I'd like to see the following: Notes1.Should the only type be strings (disregarding 2.Each line represents a command and its arguments? Is this a problem? 3.Is it a problem that Bash doesn't display errors for undeclared variables? 4.Function returns- only numeric. Issue? 5.Inconsistency in control flow structures. 6.Bash is not self-contained and does not have a standard library. Scripts depend on the environment you are working in, which typically makes scripts have a bunch of moving parts. Also, a Bash script generally uses a lot of other small languages, like Awk, Sed, and Expect. This is kind of just part of the shell game, but better integration is desired. 7.Is the lack of simple arithmetic operations a problem? 8.Portability vs features? |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |