Hello World

interpretive language scripts


Moderator: Forum moderators

Post Reply
User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Hello World

Post by wiak »

#!/bin/sh
# Hello by wiak. Created 23Jul2020. Licence MIT - joking ;-)

message="Hello"
you="Jimmy"
many="You Folks"
howmany=3
too_many="all $howmany of you"

echo Hello1
echo "Hello2"
echo "$message"3
echo "Hello${message}"4
echo "Hello5 $many"5

# A Comment
# From man page:
# If the first operand is −n, or if any of the operands contain a
# <backslash> character, the results are implementation-defined.
# ...
# It is not possible to use echo portably across all POSIX systems
# unless both −n (as the first argument) and escape sequences are omitted.
# ...
# The echo utility has not been made obsolescent because of its
# extremely widespread use in historical applications. Conforming
# applications that wish to do prompting without <newline> characters
# or that could possibly be expecting to echo a −n, should use the
# printf utility

printf "Hello6\n"
printf "Hello7 Jemima\n"
printf "Hello8 $you\n"
printf "%s again %s\n" Hello9 Jemima
printf "Hello10 %s\n" "$toomany"

printf "%s all %d of %s\n" Hello11 $howmany "$many"
# but oft-safer to always use quotes:
printf "%s all %d of %s\n" "Hello12" "$howmany" "$many"

you="World"
printf "The last %d greetings of %s:\n" "$howmany" "$message $you tabbed"

printf "Hello %s\t" World
printf "Hello %s\t" "$you"
printf "%s %s\n" "$message" "$you"

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Post Reply

Return to “Scripts”