Skip to main content

Questions tagged [syntax]

0 votes
0 answers
12 views

I'd like to use constants to build regular expressions. However, in this case I got an unexpected syntax error: me:~> cat foo.pl #!/usr/bin/perl use strict; use warnings; use constant CR_SAFE =&...
U. Windl's user avatar
  • 1,777
2 votes
3 answers
213 views

I have a script that parses command line arguments. The intro to the loop to iterate over the argument array looks like this: for arg in ${args[@]+"${args[@]}"}; do Can someone explain this ...
OneCheapDrunk's user avatar
14 votes
2 answers
1k views

I of course realize the need to have something that separates the condition to the actual commands to be executed under the control statement, but why were it chosen to use both semicolon and a ...
skyking's user avatar
  • 492
10 votes
4 answers
976 views

Without ;;&, /bin/sh gives Syntax error: ")" unexpected (expecting ";;"). ;;& triggers shellcheck's ^-- SC2127 (error): To use cases with ;;&, specify #!/usr/bin/env ...
Swudu Susuwu's user avatar
2 votes
2 answers
397 views

I want to know if there is another alternative in Bash to execute multiple blocks when the pattern matches. I don’t want to use another command, if statements, or two or more separate case blocks or ...
ReflectYourCharacter's user avatar
2 votes
1 answer
185 views

Continuing Semicolon in conditional structures (which handles single brackets), what's the point of having a semicolon after the closing DOUBLE bracket ]]? In my tests, running #!/bin/zsh -- if [[ &...
AlMa0r's user avatar
  • 1
0 votes
1 answer
135 views

So, i was given a task to implement simple version of cat utility. It should support some of GNU keys, for given text returns the same results as real cat utility and i was given this synopsis: cat [...
Mark's user avatar
  • 99
2 votes
2 answers
509 views

I need help in determining why I get syntax error near unexpected token `then' from the following command: for vm in {20..30} ; do ssh -q -o "StrictHostKeyChecking no" 192.168.210.${vm} &...
Bjoern's user avatar
  • 59
2 votes
2 answers
784 views

A bash command: $(System.DefaultWorkingDirectory)/yq_linux_amd64 '. *= load("${{ parameters.HELM_CHART_PATH }}/values/DEV/${{ parameters.COMPONENT }}.yaml")' ${{ parameters.HELM_CHART_PATH }}...
Mihir's user avatar
  • 47
5 votes
1 answer
145 views

I am using the following version of the bash: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) Man bash states the following for the "group" compound commnad: { list; } list is ...
Yakog's user avatar
  • 517
0 votes
4 answers
182 views

There are two cases in which I do not understand why bash behaves as it behaves regarding syntax checking and asking for a newline. Case 1 bash can execute the line ( (ls) | cat), but depending on ...
Bastian's user avatar
  • 25
2 votes
1 answer
97 views

When trying to get the PID of a shell command, it is possible using a script file: #!/bin/bash ls -lha & echo "$!" However, it is not possible using only the terminal. /bin/bash -c 'ls ...
danieltakeshi's user avatar
-5 votes
1 answer
78 views

After I wrote prompt $ sort display doesn't shown anything what the next step?
Wahyu Irawan's user avatar
0 votes
1 answer
2k views

I have tried #!/bin/bash distro="" myvar1=[[ -n "$distro" ]] && echo $distro || echo "debian" myvar2=$((-n $distro ? $distro : "debian")) these are ...
mrjayviper's user avatar
  • 2,303
0 votes
5 answers
224 views

What is the difference between using code $variable and ${variable}2 ? Example: file ='GLOBAL_AR_COLLECTOR_COMMENTS20240614ALYSSAB.TXT' prefix ='GLOBAL_AR_COLLECTOR_COMMENTS' In my shell script code ...
Celestica - Prabhahar Palanive's user avatar

15 30 50 per page
1
2 3 4 5
14