Questions tagged [scripts]

A script is a series of instructions written in a "plain text" file. The script interpreter (for example, Bash or another shell, Python, Perl, Ruby, etc.) reads the file and carries out the instructions as if they had been entered at the command prompt.

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

How to keep variables “updated” when they're run in a function in the background, while those variables change in the foreground

Simply said, I have a function that runs in the background &. In the foreground, the script continues of course. In the foreground, the variable var is changed (let's say from foo->bar). When I ...
0
votes
0answers
22 views

Visual Studio Code and Bash

I just started learning how to use Linux based systems and bash ,I installed VS Code and added extension Bash Debugger by rogalmic but after executing this simple program: #!/bin/bash echo "Hello ...
0
votes
1answer
29 views

How to automatially detect status of the network interface with NM

I have eth0 device and tun0 device (VPN) and I would like to automatically detect if any of these devices changes status, i.e. they are up or down. In each case, I would like to automatically call a ...
0
votes
1answer
36 views

How to make a notification system inside a script

I have a (for me atleast) quite complicated question. See below: #! /bin/bash notify=false a=0 while ((a <= 50)) do echo $a a=$(echo "$a+1" | bc) sleep 3s done When I run ...
0
votes
1answer
22 views

can't run python script with crontab and startup application

I have a simple python script that compares date of a file to the current date and prints something on screen. I want to execute this script every time I log in. I try to add the script to the startup ...
0
votes
0answers
19 views

Bash script not executing when choosing option run instead of 'run in terminel' in ubuntu 20.04

I am running on Ubuntu 20.04, I have a simple file named hi.sh which contains #!/bin/bash echo "Hi" read -p "Enter:" now when I double click on this file, it gives these options: ...
0
votes
0answers
21 views

SSH verifity host authenticity in bash script

I am writing a script to automate our backup process. In the script, I have the following code that will transfer the files to my local machine: sshpass -f local.pass scp web_file.tar user@machine:/...
0
votes
2answers
20 views

Check if a cronjob still writes to a log file

I want to define a cronjob like this: @hourly /path/to/my/script.sh &> "/path/to/my/logs/$(date +%Y-%m-%d_%H-%M-%S.txt)" So it should write the output of the script to a log file. ...
-2
votes
0answers
23 views

Is there any programming website? [closed]

I am not found a application for Ubuntu were you can programming how Phython. Can one of this community help me? Lg Hauke
0
votes
1answer
74 views

Create bash script to auto put files in folder of the same name?

I'm very new to writing Linux scripts but I'm trying to do something rather complex. I'm trying to write a program that can read part of the file name of a file and put it into a folder named the same ...
0
votes
0answers
11 views

how to debug /etc/NetworkManager/dispatcher.d scripts

The documentation says: NetworkManager will execute scripts in the /etc/NetworkManager/dispatcher.d directory It also says: The environment contains more information about the interface and ...
1
vote
2answers
72 views

How to add .sh extension to script files in Linux

I have a dozen of files without extention, and I need to add .sh to all the files are a script Bourne-Again shell. How do you achevie that without using sed, awk,... I located the files like so: file *...
0
votes
0answers
24 views

Run a piece of code in the background while using a script

Hey there I have a (for me atleast) complicated question. I have a script that interacts with the plex (and sonarr but that isn't important) api. I made it look and work like an interface. See the ...
0
votes
1answer
42 views

I want to create a shell script wherein each project has set of instructions

I want to create a shell script wherein each project has set of instructions which includes setting different groups to setup for every different clearcase view. I am facing difficulty as the setview ...
0
votes
1answer
31 views

What programming language do I use, when I write code in terminal of Linux?

I was advised to use this code to implement watch in Linux: while true; do echo -ne "`date`\r"; done Now I wonder what programming language is it written in, and additionally can you advice ...
0
votes
1answer
23 views

I need help to write a bash script for remove and change the permissions that I gave to my ubuntu 20.10 installation files by mistake

I need some help to write a specific bash script to fix the permission problems that prevent my ubuntu 20.10 from booting properly. Basically this script should : remove the +x permission from each ...
1
vote
1answer
32 views

Bash Else/If statement based on Window Renaming

I'm trying to create an else/if statement in bash so that when a window renames itself to something. Example: The spotify renames to Sponsored Message or Advertisement) I can run an if to mute amixer, ...
0
votes
1answer
37 views

Whats the benefit of using a shell script instead of a executable? [closed]

Whats the benefit of using a shell script instead of a executable? I bought a game and it came with a shell script instead of a executable file. Is that somehow easier to use?
0
votes
0answers
19 views

how to get “Enter” input on read? [closed]

I want get enter input when i want create new key Key example: -----BEGIN RSA PRIVATE KEY----- MIICXAIBAAKBgQC+jjpn+xAhaLqKWCMQJgrhjPI71mfu4lp8Rt5eyvRUu1eTQ/Qy szRwDtdSU2sPTW4V2TCsadi8YIdFu5crpsKmkh+...
0
votes
0answers
25 views

Automatic Captive Login Ubuntu 20.04 Using Ethernet

I'm using campus PC connected to the WiFi via Ethernet. Every 00:00, it reset all network connection. How to automate captive login every time it's not connected? I'm using Ubuntu 20.04 and Firefox ...
1
vote
0answers
23 views

pkill inside the cron script kills next commands

I have a hash.sh file which runs as cron job. Inside the script I need to call pkill to clean some redundant process. But when pkill is called whole script ends up immediately and next commands are ...
0
votes
0answers
30 views

Attempting to run python script from terminal using shebang returns error (for a course)

I've been trying to figure this out for a day or so browsing, when attempting to run from zsh shell using 'shebang' this is what I input into terminal: % chmod +x words.py % ./words.py http://...
1
vote
0answers
64 views

Error while trying to install speedtest script

I'm trying to install Speedtest script on my Ubuntu VPS according to the guide located at https://www.speedtest.net/apps/cli but received an error - please see below: sudo apt-get install gnupg1 apt-...
0
votes
1answer
42 views

How to open terminal from terminal and run a program(script)? [closed]

I recently started to program using Sublime Text 3 (I use gnome-terminal) and I was trying to make a script that compiles my C++ programs and runs them in a terminal window. I became making this ...
0
votes
0answers
37 views

How to fix “set -e -o pipefail” (CentOS script) for Ubuntu 18.04 LTS?

I'm working with a set of scripts that automate some bioinformatics (mitoVGP; https://github.com/VGP/vgp-assembly/tree/master/mitoVGP) and then the install is done as a conda environment. The problem (...
0
votes
0answers
27 views

How to see if the permissions of a file are influenced by something else

I have a question. See this link. I have the problem that sonarr can't update because the permissions aren't right for the file styles.css.map. Doing sudo chmod 0664 styles.css.map didn't work (...
0
votes
1answer
33 views

Disable mouse and touchpad with shell script

Due to unfortunate event, my mouse seems to have gone into a permanently clicked state making my laptop nearly unusable. Otherwise, the hardware (audio, HDMI, USB and even keyboard, etc.) and the OS ...
1
vote
0answers
36 views

Using loop index inside of awk

I apologize if this has been asked before. I think very similar questions have been asked but not one exactly like this. I have a file that contains some columns lets say it looks like this 1 3 4 12 3 ...
2
votes
0answers
78 views

Bash script to start venv in VSCode from Ubuntu Desktop

I'm following a tutorial from a Windows guy creating a bash script to start Virtualenvironment in VScode. I try to do the same thing under Linux Ubuntu 20.10. I use last version of VSCode (1.53.2) I ...
1
vote
3answers
61 views

Executing cp Excluding Files from Bash Script

I am currently writing a bash script to automate a task for my research, i.e., procedurally creating multiple scripts that will be sent to a cluster. My bash script is composed of a copy operation ...
0
votes
0answers
33 views

Why is my command line in script modified before execution

I am trying to create an rsync script and am having problems with my parameters. This is section of script causing problem. rsync -inaruAX --stats --exclude={.[a-z]} $source $destination > "$...
0
votes
0answers
44 views

Script runs without echoing

I have a simple shell script that includes the following lines echo "Hello" g++ main.cpp -o mainOutput echo "Shell script ended!" When I run the script using a terminal, it ...
0
votes
0answers
20 views

Creating non unattended custom Ubuntu Server (Minimal Install) ISO which only asks for disk and hostname during installation

First of all this is not a duplicate of : How do I create a completely unattended install of Ubuntu Desktop 16.04.1 LTS? I'm not looking for an 100% unattended install. It needs to be attended and ...
0
votes
2answers
70 views

how to check already executed programs in Linux?

I'm running various Cron tasks in my Linux machine. Recently I updated it and want to check if it is working fine. For example: 0 6 * * 1-5 /scripts/foo.sh Except for the case that I check during the ...
0
votes
1answer
24 views

How to replace text from a match (but not every match)?

I want to replace AllowOverride None from the group that has /var/www/ path. I'm using sed to do this but it's replacing every match. apache2.conf before running the script <Directory /> ...
0
votes
0answers
30 views

ubuntu 16.04.01 startup application freeze the 'shell script' execution until login

i have shell script added in the 'start application' launcher of ubuntu 16.04.01 and it had launched the terminal,but it had freeze the execution until i login and is there any modification change ...
0
votes
1answer
43 views

Use crontab to execute php file

I try to put this in crontab : 50 19 * * * /usr/bin/php -f /var/www/html/phpscript.php this PHP script works well with php /var/www/html/phpscript.php... I already follow many tutorials on the web, ...
0
votes
0answers
28 views

How to change where a screen starts in a bash script

I have seen similar questions this but none have accomplished exactly what I need. I am trying to create a screen that is detached run a program inside of it and all that is fine. My problem is re ...
0
votes
0answers
33 views

Motd is displayed twice or not at all

I've been getting this annoying issue where I cannot edit my /etc/update-motd.d/ files correctly without messing it up. Now for some reason no matter what I do, my motd is displayed twice or not at ...
0
votes
0answers
62 views

WSL Kubuntu - How to launch Kubuntu (and Gnome) in WSL

I have installed WSL with Ubuntu, and it is able to launch XFCE graphical environment, by a batch script file with these commands: start /B x410.exe /desktop ubuntu2004.exe run "if [ -z \"$(...
0
votes
0answers
29 views

Docker | PM2 | Bash - PM2 error: Error: Interpreter bash is NOT AVAILABLE in PATH

I'm trying to Dockerize a pm2 server that runs a shell script but I keep receiving this error PM2 error: Error: Interpreter bash is NOT AVAILABLE in PATH. The shell script works directly in the ...
0
votes
1answer
41 views

Writing a script to rename and move files

Current work server has images arranged in the following folder structure: . └── Plans ├── Area 1 │   ├── Location 12.jpg │   ├── Location 34.jpg │   └── Location 37.jpg └── Area 2 ...
0
votes
0answers
27 views

How to change screen aspect ratio from bash?

So I have Ubuntu installed on a motherboard, which I connect to, two different displays back and forth. It's a little painful to manually change the settings every time, so I want to write a bash ...
0
votes
0answers
30 views

Running multiple instances of a program in Ubuntu Server 20.04

I have a very basic server set up on an old desktop PC at home running Ubuntu Server 20.04.2. I have been able to get it hosting inbound and outbound connections for a Minecraft Bedrock server (using ...
0
votes
0answers
66 views

how to solve the problem of getting printed lines with command sudo?

i was trying to install ROS on ubuntu 18.04 then after a multiple of failure i found that i have done something wrong with the system. that when i open the terminal there is this lines: bash: /opt/ros/...
0
votes
2answers
34 views

Bash script with sudo installs files in root's home directory, How can I fix this?

So, I'm working on my first bash script, it is to install my dotfiles on a new system,there's a few git clones and this messes up things because it install them in the root's home directory when the ...
0
votes
0answers
65 views

Minecraft Server scripts with screen and crontab

Currently I am hosting my own minecraft server for my friends. I have created a "start.sh" and "backup.sh". I would like my start script to run at boot, I would like it to start in ...
0
votes
2answers
53 views

Linse Numbers and mysql COUNT don't work together with BASH

I am trying to calculate a number result from the Mysql with the number of lines in a particular file: Counter=$(mysql -u USER -p'PASWORD' -s -N -h localhost -e "select COUNT(*) from Database....
0
votes
0answers
23 views

Can I extract the “copy all as CURL” data from command line?

I need to extract some data from a webpage on a regular basis, and simulating the login process with curl is not going well, however I can do it simply with xdotool, then I just need to use chrome's ...
0
votes
0answers
30 views

Bash output redirection is not writting into the file

I use redirection frequently, also with "tee". But this time, no output is generated, or it is delayed until the whole script is run until the end, before something is seen in the file. Here ...

1
2 3 4 5
119