Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
16 views

how to make a bunch of command to automatically run as root on wakeup from suspend?

I have seen lot of answers on this nothing seemed to work on my system (probably I did mistake) I have dkms module of wifi installed which does not reload itself when I resume from suspend. So i need ...
0
votes
0answers
36 views

How to execute script on my Ubuntu via PHP from site

How can I use PHP to execute a script on my Ubuntu server? The site is hosted on the same machine obviously. I read about exec_shell() and tried this <?php $output = shell_exec("ls /var/www");...
-5
votes
1answer
51 views

Why i got 0 answer when i tried to make 1 mistake all the scores [on hold]

#!/bin/zsh echo "enter quiz1 score:" read quiz1 echo "enter quiz2 score:" read quiz2 echo "enter seatwork score:" read seatwork echo "enter exam score:" read exam echo "enter lab1 score:" read lab1 ...
-1
votes
3answers
449 views

Download files from a list using wget

I have a file which contains downloading links like this: Google.com/image2 Google.com/image3 Google.com/image4 Google.com/image5 Google.com/image6 I want to download all of them using a script. If ...
2
votes
2answers
56 views
+50

System wide variables for both init scripts and system?

I created my own init scripts that use variables: #! /bin/sh case "$1" in start) echo "Starting Public API" sudo -u techops sh ${JBOSS_HOME_PUBLIC_API}/bin/standalone.sh > ${...
0
votes
2answers
46 views

alias not working inside bash shell script

When I search for .bashrc files in my system I get: /etc/bash.bashrc /etc/skel/.bashrc /root/.bashrc /usr/share/base-files/dot.bashrc I changed: /etc/bash.bashrc /root/.bashrc I added the alias....
0
votes
1answer
61 views

How to delete a line from a file containing sh extension?

I'm using Ubuntu. I have an fileName.sh file containing 1000 lines and I have to delete the 399 number line is this command is sufficient for the deleting the line. Command:- sed -i '399d' test.sh ...
0
votes
1answer
51 views

Create a simple GUI installer page for my shell script

I have a shell script which when executed asks user inputs and save it to a file and later it will create a docker container based on user inputs. I have to create a simple GUI page with check boxes ...
1
vote
0answers
16 views

No manual entry for xerces

How do I install xerces so that I can use it for schema validation? I've tried: libxerces-c-doc libxerces-c-samples libxerces-c3.2 libxerces2-java libxerces2-java-doc Probably it's installed, but ...
3
votes
3answers
452 views

shell script to remove files didn't work

I want to delete multiple images having resolution less then 228x228. For that, I wrote this shell script: #!/bin/bash for i in $( ls ); do if [$(identify -format "%w" $i) < 228] && ...
1
vote
2answers
64 views

Enable automatic updates from command line

I'm creating a BASH script that will, among other things, enable automatic updates, important security updates, and the "Check daily" option in the software updates menu. But no matter where i search, ...
0
votes
0answers
40 views

problem to run script.sh in crontab [duplicate]

I would like to run a script with crontab -e. I'm running ubuntu 18.10. In terminal it works. #!/bin/bash #themes day=Yaru night=Yaru-dark #time time_start=7 time_end=20 currenttime=$(date +%H) if ...
1
vote
1answer
29 views

Save opened images and reopen them after reboot

My linux scripting skills are poor so I'm hoping someone can help. I have 50+ images open via FEH from many different locations, I do not want to individually search for them after reboot. ps aux | ...
1
vote
2answers
93 views

Automate the mysql secure installation using shell script

I am trying to automate mysql secure installation using linux shell scriping. I have below code got from https://gist.github.com/Mins/4602864. #!/bin/bash MYSQL=$(grep 'temporary password' /var/...
1
vote
0answers
77 views

Trouble with a crontab script modification failing

I have a crontab that calls a script syslogtar.sh in /usr/bin. It is in my path and has been running fine for over a year. The script goes into each firewall log directory runs a find command pipes ...
1
vote
2answers
39 views

Rename multiple files sequentially and starting by the same prefix

I have a folder containing like 1500 files, I want to rename them automatically via the terminal or a shell script as follows: "prefix_number.extension". Example: cin_1.jpg, cin_2.png ...
1
vote
1answer
38 views

Change global environment variable using a script that is started using xbindkeys?

TLDR: I have a simple shell script that flips an environment variable from value foo to bar, or the other way round, depending on its current value. I use F12 to trigger this script, and I know that ...
0
votes
1answer
25 views

rsync commands automation [duplicate]

I want to automate multiple rsync commands like below: Execute rsync1 Display output of rsync1 in the terminal Ask confirmation if want to continue rsync2 Execute rsync2 Can someone help?
0
votes
0answers
22 views

Create Automatic EBS snapshot

I was looking to setup automatic EBS snapshot at a particular time interval (let say once every week), for this I did Google and found that this task can be done using shell script and I found the ...
3
votes
1answer
57 views

How to suspend/resume cronjob if one is already running?

I've tried this solution to prevent duplicate cronjob from running. 30,31 12 * * * /usr/bin/flock -n /tmp/my.lockfile ~/Desktop/test.sh >> ~/Desktop/test.log 2>&1 and script test.sh has ...
0
votes
2answers
52 views

creating text file with regards to file names

I have a text file (digit.txt) consisting of one column includes three digit numbers whose range are 001-...365. In the same directory, I have data text files. The file name of these data files as ...
1
vote
2answers
58 views

How does Command substitution, dig and +short work within this script?

Could someone please explain how dig and +short work within this script and why they are used? Also could someone explain how the command substitution works within the code as I am struggling to ...
1
vote
1answer
40 views

How would I ping IP address produced from script?

Scripting novice here. I have created a script which can show you the ip address of the website which has been entered. My script: ! /bin/bash echo "Enter web address : " read address echo "...
0
votes
2answers
64 views

How to read first four characters of file name?

I have several files whose extensions are .gz with similar filenames to: ANKR00TUR_R_20183350000_01D_30S_MO.crx.gz I need to read the first four characters of these files' names and store these ...
1
vote
2answers
39 views

/etc/init/rc-sysinit.conf file is missing in Ubuntu 18.04.01

I'm creating a Ubuntu 18.04 (Bionic) template. Before I make a VM template, I adapt some files under /etc. However on 14.04 I had an file under /etc/init(not init.d)/rc-sysinit. Actually I'm missinng ...
1
vote
2answers
21 views

unexpected EOF and syntax error: [closed]

I can run below codes line by line using terminal without problem but when I run the script file I got line 14: unexpected EOF while looking for matching `"' line 30: syntax error: unexpected end of ...
0
votes
1answer
28 views

nmcli, how to get “connection.id” or “general.name” of device

I am writing a script on 16.04; to show connection identification, especially for VPN connections, by listing active connections with ip -o link sh up | awk 'BEGIN{FS=": "} $2!="lo" {print $2}' and ...
0
votes
1answer
107 views

bash: build/envsetup.sh: line 1: syntax error near unexpected token `$'{\r'' [duplicate]

I have my server running Ubuntu 18.04 LTS, I used it to host my personal stuff, stream media, bots and doing android builds. A month ago I saw some errors while executing the envsetup.sh script that ...
1
vote
1answer
34 views

How would I export information produced from script onto a text file [duplicate]

Scripting novice here. I have created a script which can show you the ip address of the website which has been entered. My script: #! /bin/bash echo "Enter web address : " read address echo "...
1
vote
1answer
39 views

For loop not working

I'm creating a bash script that among other things, checks a list against another list. Basicly, I created this for loop to check the file "data.txt" for every item in "names.txt" And all matches ...
-1
votes
0answers
42 views

Running Ubuntu docker (bash script) on windows [on hold]

I have an Ubuntut docker image, with a startup script /usr/local/bin/run.sh. On Linux I run: docker run -it ssmbox /usr/local/bin/run.sh It works like charm. On Windows I'm trying to run (from ...
1
vote
1answer
82 views

What does the command 'chmod +x $1' in terminal do?

I want to install an application but I don't know what this command does: chmod +x $1
1
vote
0answers
23 views

How to install and use pup from golang?

I installed go through snap; now how do I invoke pup? thufir@dur:~/pup$ thufir@dur:~/pup$ go get github.com/ericchiang/pup thufir@dur:~/pup$ thufir@dur:~/pup$ curl "skynet.be/nieuws-sport/weer/mijn-...
0
votes
0answers
11 views

Getting permission errors running windows script against an smb share

I have an SMB share in OpenMediaVault that is a mapped drive in windows. I have a user (Jerry) in omv that is the same name and password as my user in windows. I am trying to run a scheduled task in ...
1
vote
2answers
41 views

Using SED to delete text in a file

I am trying to create a bash script that will manage a basic inventory system for a friend. Everything he wants to inventory has a barcode, that when scanned, returns a 6 digit number (EX. 000001). I ...
0
votes
1answer
16 views

Automatic route deleting in a specific network

I'm on Ubuntu 18.04 and I try to learn more on netplan. When I'm in school's network I need to access to the LAN but I don't want my internet traffic goes by their gateway. I can connect to network ...
9
votes
3answers
587 views

What is the meaning of & at the end of a command?

I have a startup script line: pyprogramm >> /dev/null 2>&1 & Meanings: >> /dev/null - redirect stdout to null device 2>&1 - redirect stderr to stdout (that is ...
3
votes
1answer
139 views

Is it possible to permanently show notifications on my screen?

With the command notify-send, it's possible to show a notification on screen for a small amount of time. But I'd like to have a specific notification on my screen for an undetermined amount of time. I'...
1
vote
0answers
38 views

execute sh file with Russian or Chines Chars - Saved as UTF-8 or Unicode

I have a file which has some russian characters in it: #!/bin/sh sed -i "s/\bVAR1\b/Привет, как ты/g" file1.txt When I save this file I had to save this as UTF-8 or Unicode format as I have some ...
1
vote
1answer
102 views

Create bash script that allows you to choose multiple options instead of just one?

I'm thinking about creating a bash script where multiple options can be specified and at the end define the variables according to the chosen options or execute certain orders when receiving the ...
0
votes
0answers
34 views

turn off redirection to /dev/null

within a bash script, the following line somecommand 2>/dev/null directs error output (FD2, stderror) from somecommand to /dev/null, but also apparently directs stderror from every subsequent ...
0
votes
0answers
19 views

Linux system equivalent to MS-DOS .bat file [duplicate]

I would like to write files that when opened open a terminal window and perform a series of commands, the reason for this is I want to eventually schedule them to run hourly, daily etc, and some of ...
4
votes
2answers
338 views

Dealing with space in file links using bash [duplicate]

I got a problem. Here is my bash script to merge videos with subs: #!/bin/bash cd /media/ptrknvk/'TOSHIBA EXT'/Shows/My/'Doctor Who'/ url0='DW s11e0' url1='DW\ s11e' for(( i=1; i<11; i++ )) do ...
-2
votes
0answers
27 views

Make History Append to File at Shutdown

The Problem: I wish to have a file called history.txt. I want this file to only be accessible by root and if possible be in the root directory. This file should be written by a script (see script ...
0
votes
0answers
17 views

Run adduser interactively with a script password problem [duplicate]

I am able to run the adduser command with a script automaticly, but I have no idea how I can get the script to automaticly enter the password hello without needing to type it. Do you have any ideas? ...
2
votes
2answers
135 views

Skip notify-send job if screen locked?

I have a cron which runs a script every hour, it uses a notify-send for a notification on the Ubuntu 18.04 desktop (Gnome) once it starts. What can I add to the script to: If screen is locked then ...
-1
votes
1answer
57 views

what's the difference between the ls and `ls` in bash [duplicate]

Hello guys i like to know what's the difference in the bash i used ls without ` ` in bash so my program did not work and when i add ` ` it works, what's the object of it for i in `ls` do if [ -...
1
vote
1answer
22 views

Get process name behind a window

I'm trying to make a script that checks if Spotify is closed. I tried the following to print the number of open Spotify windows, but it doesn't work. wmctrl -l | grep "Spotify" | wc -l The reason is ...
0
votes
1answer
44 views

Bash file automation

I have scenario like below : I have a bash file named infra.sh. Inside this infra.sh file I have the below commands: #!/bin/bash gnome-terminal -e 'sh -c "bash ./redis-server.sh && sleep ...
1
vote
1answer
45 views

how to read all lines one by one from CSV and create multiple XML files accordingly(one file for one row) using shell scripts

I am trying to write a shell script to create multiple .xml files based on the data read from .csv. I need the help on how to make the loop for each .xml file creation. Rough algorithm for this ...