Questions tagged [syntax]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
25 views

alias in ash - limitation, syntax issue?

I'm running OpenWRT in a NAS (WD-MBL) and putting together a set of aliases to make maintenance easier via the command line. These work as expected: alias shutdown='sync && wait && ...
user avatar
  • 31
2 votes
1 answer
38 views

tmux configuration: command output substitution doesn't

I am trying to make parts of my .tmux.conf file conditional depending on the kind of system I'm on. For a start, I want one part to only be processed on MacOS. The man page says that I can use the #(...
user avatar
-6 votes
1 answer
63 views

Is there an example for a shell or computing accessibility culture aspiring a shell with more special characters and if so what is it? [closed]

I was always a bit frustrated from the lack of characters in modern computer systems such as, from what I know: A global template literal character for which the closest character today is a backtick ...
user avatar
  • 115
0 votes
1 answer
37 views

How do I append the outputs of the echo -e command into two separate files, simultaneously?

First, Thank you for your time and effort to help me with this situation. Now, without further ado, my issue. I am a student in Cybersecurity and I am attempting to make bash script to enumerate my ...
user avatar
-1 votes
2 answers
51 views

averaging a column of a file

I have a CSV file (with time-stamped data), and I have a script that will break each month of the year into a separate file.  The script will take that month and average out the data to a single value....
user avatar
0 votes
0 answers
62 views

Checkers problem with syntastic vim plugin

I have carefully read the documentation, tried everything, but unfortunately I have not succeeded. I tried to enable Ansible and Python checkers, but something does not work. The strange thing is that ...
user avatar
-2 votes
2 answers
70 views

bash error syntax random number [closed]

My assignement is to show a random number (od -vAn -N4 -tu4 < /dev/urandom) between two numbers in read. I don't understand why there are syntax error when I check the min value exception and with ...
user avatar
0 votes
1 answer
36 views

linux shell script with if and shopt [duplicate]

I've written the following shell script: #!/bin/bash ... #delete downloaded file if [ "$param" == "delete" ]; then shopt -s extglob cd $DataPersistent/download/ rm -f ...
user avatar
  • 11
0 votes
0 answers
19 views

Get Percentage of used memory in Solaris [duplicate]

I wish to get Percentage of used memory in Solaris as non-root user. The solution proposed here does not work for me and I get error. $ /usr/sbin/prtconf 2>/dev/null | /usr/bin/awk '/Memory/ {print ...
user avatar
  • 297
-2 votes
1 answer
83 views

In the synopsis of a man page, what do ellipses following brackets mean? [duplicate]

The following image is from the POSIX documentation's section on Utility Argument Syntax. My question is this: Are the two argument forms in the image more or less identical, besides one using the ...
user avatar
0 votes
0 answers
14 views

(How To) xrandr syntax for defining GPU's as you would with XScreens?

It seems all top end (things like DE's) are depreciating XScreen/Xorg functionality which has broken multi GPU on all Linux distros I've tested (debian,fedora,arch). As xrandr/Wayland "single ...
user avatar
0 votes
0 answers
43 views

tcpdump to monitor snmp from subnet causing syntax error

I'm trying to monitor SNMP from 2 hosts on the same subnet; 10.52.17.31 and 10.52.17.32. They are on the only machines on that subnet. Using the following commands I receive a syntax error: tcpdump -...
user avatar
  • 119
0 votes
0 answers
34 views

From Client echo to server forcing me to press return?

Ok my problem is as followed I have a server that will only accept a correct combination of student name and student password. My Challenge is to brute force the password. This is all being done ...
user avatar
  • 25
1 vote
1 answer
105 views

Hyphen in bash function names [duplicate]

Am writing bash functions. It looks like function names can include hyphen: -. Thus indus-headrc () and indus-tailrc (). Had thought that only underscore is allowed.
user avatar
  • 317
1 vote
1 answer
377 views

Retry a maximum of 10 times scp command until it succeeds

I wish to retry scp 10 times and print an error message if it failed. Below is my code: #!/bin/bash FILE=$1; echo $FILE; HOMEDIR="/home/ibro"; tries=0; while (system "scp -P 3337 $FILE ...
user avatar
  • 297
0 votes
1 answer
251 views

Using a BASH script to read the output displayed in console from a third source?

I am having issues understanding how to get read to "read" information from the console instead of user input. Effectively "getline"? from console. Here is my scenario. I will be ...
user avatar
  • 25
0 votes
3 answers
282 views

Passing date command into a variable?

Ok so my problem is as followed, I wish to pass this :- echo $(($(date +%s%N)/1000000)) Into a variable "a" to it can be added to an array, something like this :- a=$(($(date +%s%N)/1000000)...
user avatar
  • 25
0 votes
1 answer
25 views

phpMyAdmin and MySQL 8.0 gives error

H!@all I am new to databases and this is the first time I have installed a MySQL-Server. When I run commands in phpMyAdmin I keep getting error messages. I have noticed that the syntax in MySQL 8.0 ...
user avatar
  • 17
0 votes
3 answers
260 views

syntax error in awk

#!/usr/bin/awk userinput='Hello World!' userinput=$userinput awk ' BEGIN { s = ENVIRON["userinput"] "\n" n = length(s) while (1) printf &...
user avatar
4 votes
2 answers
270 views

AWK CUDA version command syntax error when starts from Makefile

I have some issue I just want to catch exact CUDA version using nvidia-smi from command line and it is working in shell: $ nvidia-smi | awk -F"CUDA Version:" 'NR==3{split($2,a," ")...
user avatar
  • 41
0 votes
1 answer
59 views

How may I enter continuation lines nicer?

Usually, I type long command on separate lines like this: myapp -a foooooooo1 \ -b foooo2 \ -c foooooooooooooooo3 \ -d foooooooo4 \ bar But ...
user avatar
-1 votes
0 answers
44 views

Syntax errror near unexpected token '}'

Good evening, I am trying to create a script to approximate the value of sine with the taylor series in UNiX However I have a message error, syntax error. I unfortunately cant find where is the error ...
user avatar
1 vote
2 answers
340 views

;ls bash: syntax error near unexpected token `;'

after typing ;ls I got this return - bash: syntax error near unexpected token `;' how do I fix this?
user avatar
  • 31
0 votes
1 answer
28 views

shell programming syntax error [closed]

num1 = 20 num2 = 20 echo $(( num1 + num2 )) echo $(( num1 - num2 )) echo $(( num1 * num2 )) echo $(( num1 / num2 )) echo $(( num1 % num2 )) Error : ./practice.sh: line 53: num1: command not found ./...
user avatar
0 votes
1 answer
457 views

How do I fix this syntax error from awk in my shell script?

I have a script with two codes to pull the sum of data of a given file and print to another file and a second pulls the total number of missing data points to another file. Finally the two output ...
user avatar
0 votes
0 answers
125 views

How to make --exclude-glob work with this use case of lftp and fish shell?

I have a statement that looks like this: set cmd 'set ssl:verify-certificate false; open -u abc,def ftp.somewhere.com; mirror --only-newer --exclude-glob "{.git|node_modules|wp-config.php}" \...
user avatar
0 votes
0 answers
45 views

Why does & work instead of &; for forks in 1 line bash loop [duplicate]

If you write a 1 line shell script that forks a process, like the following: for i in {1..1000};do ./binary & done It runs, you don't need a semicolon, and if you try to use a semicolon it throws ...
user avatar
  • 486
0 votes
1 answer
103 views

What is the intended purpose of the () syntax in a bash function?

I am freshening up my bash skills. I use the term skills very loosely; I've been outta the game a long time. So, as a way to brush up, I decided to code something utilizing bash/zenity/yad. I read man ...
user avatar
0 votes
0 answers
77 views

What happens when we use ampersand `&` at the end of the pipeline? [duplicate]

Normally, when we use a pipe, the operations on the left and right of the pipe are run in separate subprocesses. The outputs of the first command are transmitted as input to the second command. In ...
user avatar
  • 1,082
1 vote
1 answer
513 views

bash can't find closing bracket?

I am writing a bash script to makup the MariaDB instance on a Synology box. When I run it, it works, but I get an error: admin@synology:/volume1/@appstore/MariaDB10/usr/local/bip$ ./mysql_backup ./...
user avatar
  • 4,225
0 votes
1 answer
27 views

NVRAM Variable syntax

I'm trying to edit the client_customlist variable in my router with Merlin firmware, and am a bit confused with the syntax; when I export it and then look at it, most of them end with 3 >, like ...
user avatar
2 votes
2 answers
411 views

Difference between GNU find -not and GNU find -prune -o -print

This answer on opening all files in vim except [condition]: https://unix.stackexchange.com/a/149356/98426 gives an answer similar to this: find . \( -name '.?*' -prune \) -o -type f -print (I adapted ...
user avatar
0 votes
0 answers
112 views

Conky script not running after being converted

I am attempting to convert an older conky widget to the new syntax of 1.10+, but I can't for the life of me figure out why it won't run. I've ran through everything to make sure it was converted ...
user avatar
0 votes
4 answers
108 views

Awk if condition error [closed]

I have written an awk command which filters based on a condition awk '{if(( (substr($0,9,3) == "TGO") && ((substr($0,1,4) == "9123" || (substr($0,1,4) == "9704"))...
user avatar
  • 33
0 votes
1 answer
28 views

quasi nested conditions in bash is failing, because of elif syntax error

I have code that performs some conditionals in bash: firstchar=$(head -c 1 /tmp/project.json) if [ $? -eq 0 ] then; echo "Hooray! nothing found" elif [ $? -eq 1 ]; then ...
user avatar
3 votes
3 answers
191 views

Compare two files on specific columns only line by line

What is the syntax inside for loop if i in [2,4,7] in awk. Also any idea how to achieve to do in below code. Thanks Input : $ cat f1 col1,col2,col3,col4,col5,col6,col7 col11,col12,col13,col14,col15,...
user avatar
-1 votes
1 answer
623 views

How to fix the error near unexpected token `else'

I am getting a syntax error at line 17 : unexpected token `else' declare -i A echo "enter any numeric value" read value if [$value > 0]; if [[ "$value" =~ ^[0-9]+$ ]]; ...
user avatar
  • 1
2 votes
4 answers
438 views

What's the difference between if ! [[ foo ]] and if [[ ! foo ]] in Bash?

I understand that ! is used to negate an if condition in Bash, but I've just seen code which takes the format: if ! [[ CONDITION ]]; then SOMETHING fi Is there a difference between this format ...
user avatar
  • 155
2 votes
1 answer
68 views

How do you interpret this complicated man page syntax?

I am reading this on a man page: [-n number-to-stat[:max-size[:min-size][:num-directories[:chunk-size]]]] I interpret this as -n is optional but how do I specify the num-directories? Preferably I ...
user avatar
  • 2,012
-2 votes
1 answer
35 views

Unifiyng lines with awk

I have the file/text bellow: apple 1 apple 2 apple 3 banana 22 banana 5 string 1 How can I run a command to return the following result? apple numbers:1,2,3 banana numbers:22,5 string numbers:1
user avatar
-1 votes
1 answer
67 views

Python Error | Basic

i tried to run this code: cd sudo apt-get -y install firefox cd wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz tar xzf geckodriver-v0.25.0-...
user avatar
-1 votes
1 answer
73 views

How to pass brackets to some program's arguments?

I am trying to execute the command like this python train.py --conv-layers [(512, 10, 5), (512, 8, 4)] but bash swears -bash: syntax error near unexpected token `(' I need train.py receive exactly ...
user avatar
  • 2,517
4 votes
3 answers
742 views

Is it possible to have conditionals in /etc/rc.local?

Is it possible to have a conditional within /etc/rc.local? I've checked many Q&As and most people suggest running chmod +x on it, but my problem is different. It actually does work for me without ...
user avatar
  • 471
0 votes
1 answer
98 views

What is the difference between sending carbon copies of mail message to other users and sending mail to multiple users at the same time

In Unix, the -c option in mailx command sends copy of message to other people and has the following syntax: mailx -s "Subject" -c "jpm,sumit" charlie < message.txt where jpm ...
user avatar
  • 183
20 votes
1 answer
2k views

Using mv command to move a file from one folder to another one - Strange example

I'm learning unix commands from a UNIX Tutorial for Beginners at surrey.ac.uk where I found a weird way to move a file. In particular, I have the folder unixstuff in the home directory, inside the ...
user avatar
2 votes
1 answer
845 views

How do I syntax check a Zsh script?

I can do it in bash using bash -n script.sh command. is this possible in zsh?
user avatar
  • 922
-1 votes
1 answer
414 views

How to search OpenStreetMap for tags? [closed]

How can I have e.g. all highway speed cameras displayed on the map, i.e. what is the URL syntax to search OpenStreetMap for certain tags?
user avatar
  • 101
1 vote
2 answers
108 views

Why are these particular semicolons necessary in this function definition and command-line?

I'm preparing for the LPIC1, exam 102. This question came my way and I absolutely blanked. I knew it when I first took the quiz, now a month and a half later it's all blurred in my head. What does ...
user avatar
21 votes
4 answers
3k views

Preferred syntax for two lines long pipe [closed]

When writing a long pipe it is usually clearer to separate it in two lines. This long command line: ruby -run -e httpd -- -p 5000 . 2>&1 | tee >(grep -Fq 'WEBrick::HTTPServer#start' &&...
user avatar
  • 38.8k
0 votes
1 answer
295 views

^ syntax error in awk when called via ssh

I'm running filesystem usage command to detect /var filesystem usage beyond 80% from one host to multiple remote hosts. My command runs fine (df -h /var | awk '$1 > 80'), but with ssh it gives me ...
user avatar