Search This Blog

2015-05-07

printf "%.2s" "hi mom" # duh!

man sh... i c dumb ppl: https://stackoverflow.com/questions/1405611/extracting-first-two-characters-of-a-string-shell-scripting
... i logged in with my google account to help you... but...
"Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site."
"You must have 50 reputation to comment"
aka: hoops!... you're the ones who are loosing!... i would help, but you don't let me :P
ahahah: shell shock"
as pessoas normais usam:
 short="`printf "%.2s" "$long"`"

... ou assim:
 short="${long#?}"; short="${long%"$short"}"

ROFL: mas todas as solucoes de merda puderam entrar...
 short=$(echo ${long} | cut -c1-2)
 short=$(echo ${long} | head -c2)
 short=$(echo ${long} | awk '{print substr ($0, 0, 2)}'
 short=$(echo ${long} | sed 's/^\(..\).*/\1/')

... anda tudo com um grave problema existencial...



"Anybody can comment on their own posts and on answers to their own questions. The restriction is only in place for commenting on other people's questions." (aka: there it is!)
^^^ uau: vai de mal a pior...

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.