Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 471 Bytes

SC3060.md

File metadata and controls

25 lines (16 loc) · 471 Bytes

Pattern: Use of undefined string replacement

Issue: -

Description

String replacement in parameter expansion is a bash and ksh extension. dash and POSIX sh does not support it.

Example of incorrect code:

#!/bin/sh
echo "${var//foo/bar}"

Example of correct code:

#!/bin/sh
echo "$var" | sed 's/foo/bar/g'

Further Reading