From 8acff16a4006ac8a84e8dc3a5acaeac296576223 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Wed, 30 Dec 2020 20:13:03 -0800 Subject: [PATCH] Created SC2279 (markdown) --- SC2279.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 SC2279.md diff --git a/SC2279.md b/SC2279.md new file mode 100644 index 0000000..c62de0d --- /dev/null +++ b/SC2279.md @@ -0,0 +1,26 @@ +## $0 can't be assigned in Dash. This becomes a command name. + +### Problematic code: + +```sh +#!/bin/dash +$0=myname +``` + +### Correct code: + +`$0` can not be changed in Dash. + +### Rationale: + +You appear to be trying to assign a new value to `$0` in Dash. + +Dash does not support this. Write around it, or switch to Bash. + +### Exceptions: + +If you instead wanted to compare the value of `$0`, use a comparison like `[ "$0" = "myname" ]`. + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc! \ No newline at end of file