Better HN
topnewbestaskshowjobs
Log inSign up

pwd_mkdb

15 karma · joined Jun 3, 2016 (10y ago) · 8 submissions

Submissions

comment 10y ago · link · parent

i try to write my scripts in such a way that if all newlines were lost, the script would still run. semicolons even where optional.

requiring the use of bash for non-interactive use? good grief.

is it possible this company has a linux bias?

the usefulness of a minimal scripting shell cannot be denied. even with linux distribs that use bash, we almost always see busybox in use. busybox is more like the almquist sh than bash.

with sh, bash-only features may not work.

for example, shellshock did not work with almquist sh.

why are bash script not given a .bash file extension to distinguish them from sh scripts (.sh extension)?

.ksh extension is often used for korn shell scripts.

comment 10y ago · link · parent

nope. reminds me of comments where someone is purporting to be able to assess the quality of software based only on looking to see when the last changes to the source code were made.

comment 10y ago · link · parent

my personal belief is that anything one can do in bash i can do in sh. not sure if that's really true in practice, but that's my belief. i never use bashisms because i do not know what they are or how to use them.

comment 10y ago · link · parent

concision gets me less code to read. that's how i define "readability". but if forum commments are any indication, i know my preferences do not follow the norm.

most programmers seems to prefer verbosity.

however in my case verbosity slows me down.

comment 10y ago · link · parent

i agree with your comment. limitation is what gives rise to creativity. however, consider that one can impose their own limitations. i can restrict myself to a subset of assembly, or c.

i would guess that even with today's popular verbose languages with hundreds of libraries, most programmers only know or use a subset of the language and libraries. strangely when i try to use these languages i feel too constrained. only because i feel i am trying to fit my own thinking into some other programmer's thinking.

sometimes this seems worth it. other times (most times) not.

whereas with assembly, i only have to fit my thinking to what the computer can do. this seems like what i should be doing if i am trying to program a computer.

comment 10y ago · link · parent

that quote from the economist on the pinboard site is great. cheers.

comment 10y ago · link · parent

solution without using sed, grep and eval (yikes!); does this suffice? i probably missed something obvious; run with ./

   case ${1-start} in
   start)
     # your script goes here...
     x=100 $0 foo 
    ;; 
   mid)
     echo "This is not printed!"
     x=101 $0 foo
    ;;
   foo)
     x=${x:-10}
     echo x is $x
   esac