[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Parameter expansions in BASH
From: |
Nicholas Chambers |
Subject: |
Re: [Help-bash] Parameter expansions in BASH |
Date: |
Thu, 2 Mar 2017 09:07:14 -0600 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
address@hidden ~ {0}]$ foo="Hello, world!"
address@hidden ~ {0}]$ printf '%s\n' "$foo"
Hello, world!
address@hidden ~ {0}]$ printf '%s\n' "${foo#* }"
world!
address@hidden ~ {0}]$ printf '%s\n' "${foo#*o}"
, world!
address@hidden ~ {0}]$ printf '%s\n' "${foo##*o}"
rld!
address@hidden ~ {0}]$ printf '%s\n' "${foo%o*}"
Hello, w
address@hidden ~ {0}]$ printf '%s\n' "${foo%%o*}"
Hell
address@hidden ~ {0}]$ foo="bar"
address@hidden ~ {0}]$ bar="Bazzle"
address@hidden ~ {0}]$ printf '%s - %s\n' "$foo" "${!foo}"
bar - Bazzle
address@hidden ~ {0}]$
http://mywiki.wooledge.org/BashGuide/Parameters
On 3/2/17 6:16 AM, Kaushal Shriyan wrote:
Hi,
I will appreciate if somebody can help me with examples the concept of
parameter expansions in bash
Regards,
Kaushal
--
Nicholas Chambers
Technical Support Specialist
address@hidden
1.800.444.9267
www.lightspeedsystems.com