[LEDE-DEV] [patch master 05/15] Use cd ... || exit in case cd fails

Jan-Tarek Butt tarek at ring0.de
Sat Oct 1 12:43:02 PDT 2016


Hi,

On 10/01/16 10:54, Felix Fietkau wrote:
> On 2016-10-01 09:44, Oswald Buddenhagen wrote:
>> On Fri, Sep 30, 2016 at 10:02:19PM +0200, Jan-Tarek Butt wrote:
>>> diff --git a/scripts/get_source_date_epoch.sh b/scripts/get_source_date_epoch.sh
>>> -[ -n "$TOPDIR" ] && cd "$TOPDIR"
>>> +[ -n "$TOPDIR" ] && cd "$TOPDIR" || exit
>>> diff --git a/scripts/getver.sh b/scripts/getver.sh
>>> -[ -n "$TOPDIR" ] && cd "$TOPDIR"
>>> +[ -n "$TOPDIR" ] && cd "$TOPDIR" || exit
>>>  
>> these two are plain broken, as the script would just exit if TOPDIR is
>> empty. you need to use braces.
> I think a better approach would be to write a wrapper for cd, making it
> easier to read and review.
> 
> - Felix

Felix, can you gif an example in the above case?

cheers
Tarek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20161001/529fdf99/attachment.sig>


More information about the Lede-dev mailing list