Skip to main content

Questions tagged [syntax]

2 votes
2 answers
93 views

Merging values from 2 YAML files in bash

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
100 views

Why can a list within a group be terminated with a space instead of a semicolon/newline as defined in the manual?

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
88 views

Details with bash's syntax checking and breaking over several lines

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
62 views

Get PID of command in one line bash script [duplicate]

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
59 views

After wrote prompt $ sort [closed]

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

bash 5.2.x + ternary operator: How can I use this combo when checking if my string variable is empty or not?

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,223
0 votes
5 answers
140 views

What is the difference between using code $variable and ${variable}2?

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
3 votes
1 answer
459 views

What is the precedence of operators '=', '||'

In this command, if curl succeeds, then res will be set to the output of curl. It seems = has higher precedence than ||. res=$(curl -s "http://example.com")||true But || should have higher ...
lamplet's user avatar
  • 35
3 votes
1 answer
230 views

Convention of parameter naming - undocumented options

GNU has long pushed for a combination of short options (-h) and long options (--help), which goes a long way to clearing up the syntactical mess of commands like tar and dd, with their legacy syntax ...
Popup's user avatar
  • 694
0 votes
1 answer
185 views

ShellCheck does not detect error? How to fix my snippet?

I likely have syntax errors in the following (POSIX) shell snippet: #!/bin/sh if tput setaf >/dev/null 2>&1; then tput_init_linux else tput_init_none; elif tput AF >/dev/null 2>&1;...
Vlastimil Burián's user avatar
-1 votes
1 answer
82 views

awk inside function causing errors

I'm trying to add the following to my .bashrc: cpu_info() { top -b -n1 | grep Cpu(s) | awk '{print $2 + $4}' } but bash is telling me: bash: .bashrc: line 131: syntax error near unexpected token `...
Mathew's user avatar
  • 243
-1 votes
1 answer
86 views

How to specify several alternative conditions (OR operator) for single case statement? (Or Alternatively, where is shell case syntax description?) [duplicate]

I want something like this: time="1m" case "$time" in *h*) *m*) *s*) echo "handling several cases for h, m, s tokens" ;; *) echo "...
Anton Samokat's user avatar
0 votes
1 answer
4k views

"Error in network definition: expected mapping (check indentation)" Syntax error in Netplan, I am trying to set up a static IP for my LAMP stack

Below are the configs for the yaml: file /etc/netplan/{filename}.yaml network: version: 2 renderer: networkd ethernets: eno1: dhcp4: false dhcp6: false addresses: [10.0....
Kyle Morton's user avatar
0 votes
0 answers
100 views

Better understanding accels/nemo file syntax to add keyboard shortcuts for custom Nemo scripts

I carefully followed the instructions to add keyboard shortcuts to custom Nemo scripts as explained in this Ask Ubuntu answer and this Stack Overflow answer. Although this technique works great to ...
Amazon Dies In Darkness's user avatar
4 votes
1 answer
131 views

lsof output file descriptor with asterisk not documented

When I run lsof I see the output java 1752736 user 9995u sock 0,8 0t0 1432559505 protocol: TCPv6 java 1752736 ...
lfmunoz's user avatar
  • 388

15 30 50 per page
1
2 3 4 5
14