help-bash
[Top][All Lists]
Advanced

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

[Help-bash] What is the difference between ${input:+x} and ${input+x}?


From: Peng Yu
Subject: [Help-bash] What is the difference between ${input:+x} and ${input+x}?
Date: Sun, 23 Sep 2012 15:49:29 -0500

Hi,

The usages of ${input:+x} and ${input+x} seem to be the same. But I
don't see the document for ${input+x}. Could anybody let me know where
it is? Is there any subtle difference between ${input:+x} and
${input+x}? Thanks!

~/linux/test/gnu/bash/man/expansion/Parameter_Expansion/${/:+$ cat ./main.sh
#!/usr/bin/env bash

echo ^"${input:+x}"$
input=foo
echo ^"${input:+x}"$

unset input
echo ^"${input+x}"$
input=foo
echo ^"${input+x}"$

~/linux/test/gnu/bash/man/expansion/Parameter_Expansion/${/:+$  ./main.sh
^$
^x$
^$
^x$

-- 
Regards,
Peng



reply via email to

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