Skip to content

Commit 2a46f53

Browse files
authored
Fix broken code examples in tables due to pipes and backticks #22
1 parent d6cbb83 commit 2a46f53

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

os-agnostic/scripting/script-language-comparison.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,8 +1205,8 @@ print(type(converted)) # Output: <class 'float'>
12051205
|------------|--------------|
12061206
| Force integer conversion | `[int]"3.9"` (becomes `3` i.e. truncates decimal) |
12071207
| Convert object to XML | `[xml]$xmlString` |
1208-
| Convert object to JSON | `$object | ConvertTo-Json` |
1209-
| Convert JSON to object | `$json | ConvertFrom-Json` |
1208+
| Convert object to JSON | `$object \| ConvertTo-Json` |
1209+
| Convert JSON to object | `$json \| ConvertFrom-Json` |
12101210

12111211
---
12121212

@@ -1249,10 +1249,10 @@ Bash scripting does not have built-in type casting like some other languages, bu
12491249
| Description | Code Examples |
12501250
|------------|--------------|
12511251
| Convert string to integer | `num=$(( "42" ))``42` |
1252-
| Convert string to float (using `bc`) | `echo "3.14" | bc``3.14` |
1252+
| Convert string to float (using `bc`) | `echo "3.14" \| bc``3.14` |
12531253
| Convert integer to string | `str="$num"``"42"` |
12541254
| Convert ASCII value to character | `printf \\$(printf '%o' 65)``'A'` |
1255-
| Convert boolean-like values | `[[ -n "$var" ]] && echo "True" || echo "False"` |
1255+
| Convert boolean-like values | `[[ -n "$var" ]] && echo "True" \|\| echo "False"` |
12561256

12571257
---
12581258

@@ -1263,7 +1263,7 @@ Bash scripting does not have built-in type casting like some other languages, bu
12631263
| Convert string to array | `IFS="," read -ra arr <<< "apple,banana,grape"` |
12641264
| Convert array to string | `echo "${arr[*]}"``"apple banana grape"` |
12651265
| Convert list to associative array | `declare -A myDict; myDict[key]="value"` |
1266-
| Convert array to JSON (using `jq`) | `echo '{"name":"Alice","age":30}' | jq` |
1266+
| Convert array to JSON (using `jq`) | `echo '{"name":"Alice","age":30}' \| jq` |
12671267

12681268
---
12691269

@@ -1272,8 +1272,8 @@ Bash scripting does not have built-in type casting like some other languages, bu
12721272
| Description | Code Examples |
12731273
|------------|--------------|
12741274
| Force integer conversion | `num=$(( "3.9" ))``3` (truncates decimal) |
1275-
| Convert object to JSON (using `jq`) | `echo '{"name":"Alice"}' | jq` |
1276-
| Convert JSON to object (using `jq`) | `echo '{"name":"Alice"}' | jq -r '.name'` |
1275+
| Convert object to JSON (using `jq`) | `echo '{"name":"Alice"}' \| jq` |
1276+
| Convert JSON to object (using `jq`) | `echo '{"name":"Alice"}' \| jq -r '.name'` |
12771277

12781278
---
12791279

@@ -1562,7 +1562,7 @@ print(my_tuple) # Output: ('apple', 'banana', 'cherry')
15621562
| **Remove One Item** (Delete element at index `2`) | `unset Names[2]` |
15631563
| **Duplicate** (Create a copy of the array) | `Cities=("${Cities[@]}")` |
15641564
| **Concatenate** (Merge two arrays) | `Items=("${Fruits[@]}" "${Vegetables[@]}")` |
1565-
| **Read from File** (Store lines of a file into an array) | `logs=(`cat "system.log"`)` |
1565+
| **Read from File** (Store lines of a file into an array) | `logs=($(cat "system.log"))` |
15661566

15671567
### **Iteration**
15681568

0 commit comments

Comments
 (0)