help-bash
[Top][All Lists]
Advanced

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

Re: how to define functions as one cmd without brackets


From: Lawrence Velázquez
Subject: Re: how to define functions as one cmd without brackets
Date: Wed, 01 Mar 2023 16:42:57 -0500
User-agent: Cyrus-JMAP/3.9.0-alpha0-183-gbf7d00f500-fm-20230220.001-gbf7d00f5

On Wed, Mar 1, 2023, at 4:38 PM, alex xmb ratchev wrote:
> .. just few days ago i think here was someone with such functions
> f() cmd ;
>
> i tried that in the scp script , and in terminal , cant such
>
> i tried
> smth() return 1 ;
> and similiar less shell keyword ing

That only works with compound commands.

        bash-5.2$ foo() if :; then echo hi; fi
        bash-5.2$ foo
        hi

https://www.gnu.org/software/bash/manual/html_node/Shell-Functions.html

-- 
vq



reply via email to

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