help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shifting a block of text


From: Alex fxmbsw7 Ratchev
Subject: Re: Shifting a block of text
Date: Wed, 8 Dec 2021 08:51:59 +0100

this is specific small codepart of your project that takes too much code
and as i thought u wont describe your project but only this stupid
codepart.. i cannot help
i told u its inefficient bullshit code
if u insist in your thing, which u only do, u know what bullshit u want u
have to type it
ignoring superior topics makes it impossible to help any, than bullshit,
which i wont do

greets

On Wed, Dec 8, 2021, 08:48 <fatiparty@tutanota.com> wrote:

>
> Dec 8, 2021, 07:40 by fxmbsw7@gmail.com:
>
> i dunno but its very nonsense
> if more args just 2 u use
>
> maybe describe the project u do more in detail and we shall see better
>
>
> shifted-block "Phrase 1" "Phrase 2" "Phrase 3"
> Print  phrases without any leading spaces (uses nc=0)
>
> shifted-block 8 "Phrase 1" "Phrase 2" "Phrase 3" ...
> Print phrases on separate lines with 8 leading spaces (uses nc=8)
>
> On Wed, Dec 8, 2021, 08:38 fatiparty--- via <help-bash@gnu.org> wrote:
>
>
> Trying to adapt the following function to use all arguments rather than
> just the first one.
> The code should introduce nc spaces ahead of the start of each argument
> passed.
> Each shifted argument must be on new line. The first argument ins
> numeric, defining
> the amount of shift.
>
> shifted-block ()
> {
> if (( $# == 1 )); then
> nc=0 ; arg="$1"
> elif (( $# >= 2 )); then
> nc="$1" ; arg="$2"
> else
> nc=0 ; arg="$1"
> fi
>
> nw=$(( nc + ${#arg} ))
> printf "%${nw}s\n" "$arg"
> }
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]