We’re rewarding the question askers & reputations are being recalculated! Read more.

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
1answer
43 views

script to “full clean” your system

I am trying to create an script to "full clean" an Ubuntu system, could you complement/modify the following commands to make it as an standard for lastest Ubuntu versions? sudo apt-get autoclean -y ...
0
votes
0answers
15 views

A generalized leechblock?

Since I seem to be unable not to procrastinate, I installed the leechblock app on my browser, which allowed me to block the access to given websites at given hours. Now, I was wondering whether there ...
-4
votes
3answers
142 views

oneliner which should redirect

I have to make a script which prints the sizes of all .conf files from /etc recursively in a specified file, and that prints the errors caused by the lack of permission in another file. I don't know ...
1
vote
2answers
73 views

How to automate the input of a password, in a custom batch file?

I know this will sound naive to most of you, but I'm still new in Linux so please bear with me. I am trying to create a batch file in order to automate a few commands. One of those commands is the ...
1
vote
1answer
47 views

Will this script safely (un)mount an NTFS partition for a swapfile?

I am using a persistent live USB running Ubuntu 18.04.3 LTS Bionic Beaver, as partitioning my hard drive is very difficult. When playing Steam games, I need a swapfile. With help from @malte-skoruppa, ...
0
votes
0answers
16 views

How to display selection menu for Bash Program [duplicate]

I am new to both programming, Unix and bash. I've created some small scripts in bash and I am still learning the basics. Looking for help! I would like to know how to display the following menu ...
0
votes
0answers
17 views

No audio from recording script while using cron

Good day, New to the group, and I am having an issue with cron. When I run this script (start.sh) to record audio in terminal it works perfectly: !/bin/bash sleep 1 source /home/will/roboradio/161....
0
votes
0answers
22 views

How to create a shortcut that stores some previous state?

What I'm trying to do is to create shortcut that opens a terminal. On pressing the shortcut the second time, I want it to switch back to the window that was active before the terminal was. I managed ...
1
vote
3answers
95 views

How to make a shell script to move files to individual folders based on the filename?

I want to automate moving TV show episode files into individual directories for each episode. Essentially, in the folder I want to run the script in, I have a list of files. For example: tvshow.2009....
0
votes
0answers
21 views

Listening to Joypad Input in Bash Script

I'm looking to write a script to kill a game process with a button combo on a joypad. Is there a way I can listen for joypad button presses in a bash script?
0
votes
0answers
9 views

How to change Recording tab from pavucontrol with terminal

I want to change the input source to a recording program (e.g. Audacity) via terminal as I would in the pavucontrol recording tab. . I found this thread already: Changing in pavucontrols tab "...
0
votes
1answer
75 views

Running Script with USB device

I want to copy a directory and its contents to my external USB hard drive when I connect it to my laptop automatically. So, I created a file called 00-usb-backup.rules on /etc/udev/rules.d with this ...
1
vote
1answer
48 views

Output redirection to a file, used inside script, is not working when executed from crontab

The script is working when executed from terminal but, it's giving "(CRON) info (No MTA installed, discarding output)" information when executed from crontab. Below are my script contents. I have 2 ...
0
votes
0answers
53 views

Remove ssh keys in github from command line [on hold]

I'm creating a script in bash to install and configure all my workspace. How do I remove my ssh keys in github from command line? I already search about and found this command, but this is ...
0
votes
1answer
41 views

virsh list is empty when run from user crontab

I have added a couple of hypervisors with Ubuntu 18.04 and added the scripts that works on 16.04 and 14.04. Among them are some scripts that are installed in the user crontab. Here's part of the ...
0
votes
0answers
17 views

What is the correct and documented way to run a script during shutdown of Ubuntu Server 18.04 LTS?

During shutdown I must make sure external HDDs are spun down. I'm hoping to do this by running a script. It doesn't happen automatically. One disk is a seagate ultra slim. I can controll it with ...
0
votes
0answers
12 views

How to put YAD form fields value into variable after submit?

How to put YAD form fields value into variable after submit? My script actually looks like this: #!/bin/bash default_jpg='/'; default_mp3='/'; default_resolution='1920:1080'; default_filename="/"; ...
0
votes
0answers
7 views

Combine JPG and MP3 to MP4 using FileManager-Actions and shell script (Ubuntu 18.04)

What I try to achieve: Expanding my Nautilus context menu by an action to simply select a JPG-file and a MP3-file to combine them to a MP4-file like I already do in terminal by this command: ffmpeg -...
0
votes
2answers
41 views

Ubuntu 16.04 not running scripts in /etc/profile.d/

I have a machine running Ubuntu 16.04 Desktop (running Unity). I was playing around with different desktop environments for xrdp, so I installed xfce4 (sudo apt install xfce4) and mate-desktop (sudo ...
0
votes
1answer
70 views

Which programming language to use when interacting with shell?

I want to write a program that uses shell commands to make changes to audio such as: pactl set-sink-volume 0 +10% As I need it during my podcast I want to be able to quickly interact with it via ...
0
votes
0answers
41 views

Batch execute ncap2 command

I want to batch execute this command ncap2 -s 'where(S<0.005) S=0.005; infile.nc outfile.nc* on all the nc files in a folder. I am using this script: for f in dir/*.nc do ncap2 -s 'where(S<...
0
votes
1answer
72 views

How do I unzip multiple files with multiple passwords in 7zipfull on ubuntu

I'm kind of a beginner in Linux and I'm having a hard time. On Ubuntu 19.10, I made a small script for 7zip to unzip multiple files with password: FILES=/mnt/sdx for f in *.7z; do 7za x -oUNZIPPED $f ...
1
vote
1answer
23 views

How to list also two lines after a grep match?

grep 'STRING' filename searches the file for STRING and lists the lines that contain a match. How can I also list two lines that follow the match?
1
vote
2answers
63 views

Why doesn't system() work when called in a loop with cd and rm commands?

I started using Linux recently, so my program is just for learning. Having said that, here's my code: #include <stdio.h> #include <stdlib.h> int main () { FILE *fin; char buf[200]; fin ...
0
votes
0answers
15 views

Ubuntu Docker: How can I specify `set -exu` globally for all scripts?

I'm using a docker image based on Ubuntu 19. I execute my entrypoint using Bash: ENTRYPOINT ["/bin/bash", "-c", "tini -- /entrypoint.sh"] I also create a user in my entrypoint script: addgroup --...
2
votes
2answers
109 views

I want help to modify a script to recognize both Firefox and Firefox (Private Browsing)

I have this script that runs via a keyboard shortcut (and toggles the Stylus extension stylesheet on/off***). It is specifically for maximized windows so the xdotool values won't change: #!/bin/bash ...
0
votes
0answers
60 views

Crontab bash script doesn't work

I have a simple script and I try to run this every 3: 00 am via crontab. #!/bin/bash /usr/bin/screen -SX fbbot quit; /usr/bin/screen -dmS fbbot /home/vemu/.nvm/versions/node/v10.16.3/bin/node /home/...
0
votes
2answers
62 views

Shutdown after a running command terminate?

I have a long-running command, and forgot to add && shutdown to it. Is there any way to shut down my PC upon its completion, while it's running?
2
votes
2answers
194 views

Xbindkeys launches correctly application for the first time only

When I put the following line in ~/.xbindkeysrc GNOME correctly launches application vlc. "vlc" XF86Calculator The problem is that I'd like to run a shell script. When I put the following in ~/....
0
votes
3answers
35 views

How to download certain folders from url

when I use this command: wget -r -np -nH --cut-dirs=6 -R "index.html*" -e robots=off "https://physionet.org/physiobank/database/challenge/2018/training/" It will download all the folders (994 ...
0
votes
0answers
26 views

Select file from system in sh scipt

I have a script that lets me concat my gopro videos into one video, I currently have it able to select from the correct folders inside and then generate a file including a logo. I would love to be ...
1
vote
1answer
40 views

Test ssh connection as root

I'm trying to make an script just to test if I can connect throw ssh as root user in a list of servers that I have in a file, for the moment i have this: for i in $(cat servers.list); do if [ "ssh ...
0
votes
3answers
39 views

What is “STRING” and “+%s” in this script using the date command?

I have the following script (based on this): #!/bin/bash runtime=$(zenity --title "Send notification repeatedly" --entry "Enter the period in minutes like this: nn minutes") endtime=$(date -ud "$...
0
votes
1answer
34 views

curl in bash script adds ? at end of the file name

I'm on Ubuntu 16.04, and I have a bash script with a curl command, for example: #!/bin/bash curl https://www.example.com/file.txt > ./file.txt The file should be downloaded with the name file.txt ...
-3
votes
0answers
26 views

syntax error unexpected token fi nano [duplicate]

#! clear echo Enter the budget read budget if((budget <=10)) then echo Tarjet else if((budget>=11 & budget<=100)) then echo chocolate else if((budget>= 101 & budget<250)) then ...
0
votes
2answers
51 views

ubuntu server Execute python script via crontab

I am trying to run a python script on a server with Ubuntu but it does not work. I manually tested the script and it WORKS correctly but I automatically tested it in 3 ways but nothing; 1 * * * * /...
2
votes
1answer
37 views

How do you copy a directory that has a variable in a path to a designated destination with a standard path

I'd like to automate the following. A bunch of stuff in a folder called ~/Backup/28_10_2019_files/LoadsofStuff needs to be copied to a folder called ~/Backup/Daily/LoadsofStuff on a daily basis. ...
0
votes
0answers
55 views

Replace string with another string in bash script?

I have a .csv sheet with 3 columns and 'n' number of rows. Column1: It defines the name of the Rule. Column2: This is the schema line present in all the test files. Column3: This is the line which ...
0
votes
1answer
51 views

Getting an “Unexpected end of file” error

I'm receiving an error saying line 44: syntax error: unexpected end of file #!/bin/sh touch $results.txt #creates txt file now="$(date)" #records current date and time to be posted echo "Name: ...
0
votes
1answer
35 views

Adding if statement to an existing while loop

I have to do add an if statement to my while loop. When writing ./scriptname 1 it executes my while lopp. When I instead write ./scriptname hello it still executes my while loop. What I want it to do ...
0
votes
2answers
44 views

How to rename the exisitng cell names based on number of their occurnaces in a particular column?

I have a column in my excel as below: REF --------- BV1013_1 BV1013_1 BV1013_2 BV1013_2 BV1026 BV1040 BV1040 BV1041 BV1041 BV1042 BV1042 Desired OUTPUT: Some of the cell values/names are same at ...
1
vote
2answers
124 views

Invisible space when trying to remove file (but exclude all files in a list)?

I'm trying to accomplish a simple task using the excellent post here: I would like to remove all files from a folder except those listed in a .txt file contained in the folder. The syntax works fine, ...
2
votes
1answer
52 views

Bash script not creating file from crontab

I have already tried half of askubuntu but still not succeeding. I got the following shell script: #!/bin/bash echo "test" > "/mnt/ssd/test.txt" echo "test" And the following crontab -e line: * ...
1
vote
1answer
31 views

Executing bash script on wakeup

Since some time I have a Prolbem with my Linux distribution (Kubuntu 18.04). Every time my linux comes back from standby modus the touchpad is not working properly anymore (can't grab and drag files ...
0
votes
0answers
34 views

Start up script .sh using systemd not working and exits with status=127

I'm trying to create a startup script .sh by using systemd (I've tried with /etc/init, /etc/init.d, crontab -e but it didn't work. I was able to solve the error the first time I configured it with ...
0
votes
0answers
25 views

Convert an existing debian systemd init script to Ubuntu 18.04 compatible version?

I need to create an /etc/init.d startup script for msmtpd and thought it would be a good idea to convert an existing one from Debian to Ubuntu 18.04. What should be done to properly convert this .deb'...
0
votes
1answer
31 views

display some text at the end of a script

At the end of my scripts I use often put "konsole" bash command, to know that the script is completed. Now I'd like to add a text within the konsole (terminal), something such as "done!". How should I ...
-1
votes
0answers
60 views

Script to change the background

On Ubuntu 19.10, I wrote a little script to change the lock/login screen background and added it to cron (every 10 minutes), all the script does is select a .jpg at random from a folder and copies it ...
0
votes
1answer
25 views

How to silently install using dpkg

I have a deb package which I want to deliver via sript. Normally when this deb file is iniated it completes with an 'OK' screen where the user must press enter. As I want to automate the installation,...
0
votes
2answers
35 views

copy content of folder to multiple sub folders

So i'm trying to understand if its possible to copy the contents of a template folder into multiple existing folders. So i have opt/application/tenant_template opt/application/tenant_template/src ...