Questions tagged [syntax]

Syntax refers to the rules of programming languages which stipulate how code is to be arranged so that the structure is syntactically correct and can be executed successfully in the particular framework of those languages.

Filter by
Sorted by
Tagged with
1 vote
1 answer
51 views

problem bashrc file colored terminal

I have a problem with my terminal in Ubuntu server 20.04. I would like to color the syntax in my terminal, but after I restart the server, it's back to the normal uncolored syntax. I edited .bashrc ...
user avatar
  • 13
0 votes
1 answer
17 views

why head -5 /filepath and head -n 5 /filepath shows the same output?

I'm sorry for this silly question but i'm new to terminals and i don't quite understand how we can pass a number of lines without an option. Even the man page says: -n, --lines=[-]NUM ...
user avatar
0 votes
0 answers
128 views

Syntax error: "}" unexpected (expecting "then")

I was sent a file to run to help setup my environment to work on my companies network but after making it executable I keep running into this error regarding a curly brace and it wanting then, I have ...
user avatar
0 votes
1 answer
387 views

syntax error near unexpected token '(' when initializing main [closed]

So I keep getting an error: syntax error near unexpected token '(' and it's referring to the line 'int main(){' in my code. I don't know why I'm getting this error, can someone please help?
user avatar
  • 11
-3 votes
2 answers
588 views

syntax error near unexpected token [closed]

I was writing a bash script where I faced the below error and I have no idea about the reason: syntax error near unexpected token `fi' my script: #!/bin/bash if [ 5 -gt 1 ]; than echo "Hello ...
user avatar
0 votes
1 answer
460 views

Using chown to change ownership on additional HDD

OS Linux 20.04. Having installed an additional HDD in position /dev/sdc1 (Label Data 22) I am confronted with root as owner. Is either of the following syntaxes correct in order to set me up as owner? ...
user avatar
  • 1
2 votes
1 answer
309 views

Add a tag to jpeg using ExifTool

I would like help with terminal syntax code please to add a tag to jpeg files using ExifTool. I want to add general notes to some old scanned jpeg pictures of my ancestors for my kids to be able to ...
user avatar
  • 75
-1 votes
2 answers
432 views

The mentioned syntax error was in this while loop [closed]

I ran the below code through shellcheck myscript and keep getting this error. How can I correct it? ****Line 48: while [ $count - lt 3 ] ^-- SC1009: The mentioned syntax error was in this while ...
user avatar
0 votes
3 answers
102 views

Why does the following zsh command change my output? [closed]

When I execute this command port=3128 echo $port:localhost I get 3128ocalhost as output. PS: When I change the first 'l' char it works fine. I can't even google it.
user avatar
6 votes
2 answers
851 views

syntax error: unexpected end of file .bash_profile

I added the below code to empty ~/.bash_profile file and after restarting and login via ssh to the server I get syntax error: unexpected end of file .bash_profile NODE_ENV=production if [ -f ~/....
user avatar
  • 71
0 votes
1 answer
1k views

ipython shows invalid syntax when running from terminal

I use python 3.7 but also 3.6 and 2.7 are installed, I am using Ubuntu 16.04 LTS. I changed the order of python to python 2.7 still not working, I am using it on VMware. I guess I made changes to ...
user avatar
0 votes
1 answer
40 views

Incomprehensible output using passwd distractedly

With little attention, after doing operations as root on an ext HDD, instead of using the correct command to disable root, I used this syntax sudo -l passwd I got this output /usr/bin/passwd I know ...
user avatar
  • 149
1 vote
2 answers
445 views

Shellcheck recommendation to double-quote variable does not work when piping to cut

I'm making a script to print ZFS filesystem info - currently in the testing phase, and I'm getting a strange error. The relevant bit of my initial script is this: zfs_human="$(zfs list | head -n ...
user avatar
2 votes
2 answers
1k views

Subtracting dates formats in bash

I am trying to create a countdown - most likely the hard way. I have it setup like this: #! /bin/bash #When to execute command execute=$(date +"%T" -d "22:30:00") #Current time ...
user avatar
  • 35
0 votes
1 answer
379 views

syntax error, unexpected 'DB_PASSWORD' (T_STRING), expecting ')' in /etc/wordpress/config-localhost.php on line 4 [closed]

I have received this error message in the log file /var/log/apache2/error.log syntax error, unexpected 'DB_PASSWORD' (T_STRING), expecting ')' in /etc/wordpress/config-localhost.php on line 4 ...
user avatar
  • 1
0 votes
1 answer
138 views

dpkg shows a curious syntax error while installing a package

While installing Brightness Controller from its ppa in Ubuntu 20.04, it shows an invalid syntax error Setting up brightness-controller (2.3.4-0~202004250741~ubuntu20.04.1) ... File "/usr/share/...
user avatar
5 votes
3 answers
4k views

How to fix ~/.profile and ~/.bashrc syntax errors

Ubuntu 18.04.4 (automatic upgrade from 18.04.3 just a few weeks ago) /bin/bash After I log in from the Gnome shell, this message appears while the screen is just plain purple and before the desktop ...
user avatar
0 votes
2 answers
520 views

When making an alias can quotation marks, apostrophes or semicolons prevent the command from working properly?

I have a file called .bash_aliases where I keep my aliases. While I have just one alias in the file it works properly, however when I try to create a new one the terminal fails to recognize the ...
user avatar
-1 votes
1 answer
259 views

Syntax error in ~/.bashrc if statement

In my terminal, it says that my .bashrc file possess a syntax error. I could identify this bit of lines from my .bashrc that were incorrect but cannot fix it. This is the part of my .bashrc that ...
user avatar
  • 141
0 votes
0 answers
82 views

Setup dual NIC for selective apps to use a VPN

I am relatively new to ubuntu but have learnt a lot while trying to fix my setup. Basically, my problem is that I have a Desktop computer that needs to connect to a VPN service for certain ...
user avatar
0 votes
1 answer
577 views

How can I find and edit multiple lines and replace them using sed on nginx/sites-available/default

I need to uncomment the existing text inside the default file the file in this site is very similar to my default file https://salsa.debian.org/nginx-team/nginx/blob/master/debian/conf/sites-...
user avatar
9 votes
5 answers
2k views

Why is a blank required between "[[" and "-e xxx" in ksh?

For instance, the following command does not work: if [[-e xyz]]; then echo File exists;fi ksh gives the following error [[-e: command not found Is that because "[[-" is ambiguous?
user avatar
  • 93
1 vote
1 answer
130 views

syntax for creating variable out of command with apostrophe in it [closed]

NOOB level: horrible at syntax and regular expressions and BASH programming in general but learning and studying for the Lin+ I'd like to run this script but it doesn't like my syntax apparently. ...
user avatar
  • 105
0 votes
0 answers
42 views

Syntax error near unexpected token `{workingDir=$(pwd)' [duplicate]

Here is the problematic line in question. function gradeUpdate() {workingDir=$(pwd); cd $GRADE_DIR; rm -Rf gradingScript/; git clone https://github.com/[redacted]/gradingScript/; cd $workingDir} Of ...
user avatar
0 votes
1 answer
98 views

What happens if no destination is defined after > (redirection)?

recently I wanted to read the man pages for mplayer. So I needed to type man mplayer in the terminal. Yet out of clumsiness I typed man mplayer>. I know that I could redirect the output e.g. to ...
user avatar
  • 575
1 vote
2 answers
6k views

linux shell script Syntax error: word unexpected (expecting "fi")

Below I have a shell script i wrote and when I try to execute it I get an error in my terminal describing the "expecting fi" keyword. I have written it down before the done keyword and have still not ...
user avatar
13 votes
2 answers
14k views

Run another command when previous command completes [duplicate]

Today I opened gnome-terminal and I wrote ls && sleep 4 && gnome-terminal to open another terminal after the completion of ls command and waiting for 4 seconds. So it successfully ...
user avatar
2 votes
1 answer
977 views

How to install Maxima and make syntax on Ubuntu Server 18.04

How to install Maxima computer algebra system, and make a syntax like the screenshot that is shown below? What is a similar application to Maxima that can run from the command-line in Ubuntu Server 18....
user avatar
-1 votes
1 answer
285 views

Syntax for keyboard shortcuts

What is the proper syntax for adding keyboard shortcuts in xfce4? From the existing shortcuts, I noticed that every shortcuts command is not the same. Different kind of syntax is used for different ...
user avatar
  • 239
1 vote
3 answers
817 views

How do you get a *.desktop file to work for a non-repository app?

I turned the Amazon cloud reader site https://read.amazon.com into a desktop app with nativefier. It works amazingly well as a standalone reader for books that have been downloaded and also ...
user avatar
1 vote
1 answer
7k views

Must apt-get install software-properties-common precede ppa:X?

This is how I currently install some basic software in my Ubuntu 18.04 server environment. I am afraid I might have some redundancy here: apt-get update -y apt-get install software-properties-common ...
user avatar
1 vote
1 answer
1k views

Python syntax error with awk, sprintf statment (2.7)

I am trying to use one of the shell commands to a python script, but struggling with some syntax error here. The description of the command is from here echo /dev/bus/usb/`udevadm info --name=/dev/...
user avatar
  • 11
9 votes
1 answer
7k views

What does the syntax of pipe and ending dash mean? [duplicate]

Disclaimer. I'm a long-time Windows user and just starting to get my head around the Linux paradigm. While excited by it, I understand that my formulations might be poorly chosen due to ignorance. I'...
user avatar
1 vote
0 answers
438 views

Can't save my sudoers.tmp file after correcting syntax error

I know there are a lot of questions regarding sudoer and sudoers.d directory, but i can't find the answers for my specific problems: There is a syntax error on every line (in both sudoer and sudoers....
user avatar
-5 votes
1 answer
3k views

"pip install pyarrow" returns syntax error [closed]

i already try to use linux cod on python.with importcommand.whats your idea to improve .do I use .os to import? how do i use it to install pyarrow in python.how can I install it atlink like windows ? ...
user avatar
0 votes
1 answer
2k views

Installing driver

I've been trying to install some intel drivers, but I get an error message. This is the text: alberto@alberto-Inspiron-5558:~$ cd Desktop alberto@alberto-Inspiron-5558:~/Desktop$ chmod a+x ...
user avatar
0 votes
0 answers
922 views

Two errors: unexpected EOF while looking for matching `'' and syntax error: unexpected end of file

#include <iostream> using namespace std; int main() { cout << "Hello World" << endl; return 0; } My current Ubuntu version is 17.10 I saved the above C++ program on my ...
user avatar
1 vote
1 answer
138 views

Pluma/Gedit REMOVE languages

I like to remove most of the languages from the pluma/gedit menues, where they show up. It's great that the editors support so many languages. But most of them I never use. So they are only in the ...
user avatar
  • 5,987
2 votes
1 answer
780 views

Space literal as function name in bash

This question is loosely related to one of my previous ones. TL;DR from muru's answer is that characters in function name have to be on Portable Character Set in order to be valid for a function name. ...
user avatar
-2 votes
2 answers
2k views

line 56 syntax error: unexpected end of file

I have typed out the code for this mychoice.sh bash example and I keep getting the syntax error: unexpected end of file. Am I missing something? mychoice.sh #!/bin/bash E='echo -e';e='echo -en';...
user avatar
4 votes
3 answers
51k views

How do I send GET and POST requests using Curl?

How do I send GET and POST requests with parameter gimmeflag and value please to the URL http://103.200.7.150:7777/ using curl on the command line?
user avatar
-1 votes
1 answer
436 views

How do I make a shell script loop through multiple if statements forever?

I've made a shell script based on a bunch of snippets and tutorials I've read. I just can't figure out how to fix a syntax error and make it work. Terminal output is: ./afkscript.sh: 2 ./afkscript.sh:...
user avatar
0 votes
2 answers
2k views

Errors were encountered while processing: install-info

$ sudo apt-get install wondershaper python-qt4 arp-scan dsniff arptables Reading package lists... Done Building dependency tree Reading state information... Done python-qt4 is already the ...
user avatar
0 votes
0 answers
284 views

Error: You must specify exactly one target process

what is the syntax to use cpulimit to throttle Web Content? Note the space between Web and Content. top - 09:16:00 up 1:09, 2 users, load average: 1.80, 1.70, 1.77 Tasks: 215 total, 2 running, ...
user avatar
  • 4,353
5 votes
1 answer
5k views

what does the -aux option of ps stand for?

You often pass options to CLI commands which cause the function to behave differently. They all have a meaning, for example -v means "Verbose" -l means "List" The ps command lists all running ...
user avatar
16 votes
3 answers
5k views

What does this syntax mean?

I am new to terminal and trying to learn how to use it. What do these lines do? And how do they work? echo -n "Today's date is: " date +"%A, %B %-d, %Y"
user avatar
0 votes
0 answers
46 views

Need to know about " . " Symbol? [duplicate]

There is a command if [ -f ~/.bashrc ]; then . ~/.bashrc I need to know why there is "." right before ~/.bashrc?
user avatar
12 votes
2 answers
10k views

For loop with Alphabet

This works perfectly on OSX #!/bin/bash chars=( {a..z} ) n=3 for ((i=0; i<n; i++)) do echo "${chars[i]}" done But when I run it on Ubuntu, I get the following error. ForLoopAlphabetTest.sh: 2: ...
user avatar
  • 331
1 vote
1 answer
2k views

"E: Syntax error /etc/apt/apt.conf.d/10periodic:7: Extra junk at end of file" how to trouble shoot this? [duplicate]

I typed sudo apt update in terminal, then I got the following error: E: Syntax error /etc/apt/apt.conf.d/10periodic:7: Extra junk at end of file The file contains: 1 # 2 # Xilinx Clocking Wizard ...
user avatar
2 votes
1 answer
4k views

Can't uninstall PHPmyadmin in Ubuntu 16.04

My PHPmyadmin (PMA) install was stuck. I started a new session and when doing apt-get purge phpmyadmin I got: E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)...
user avatar