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
33 views

How do I make my own script a part of Ubuntu by default? [duplicate]

I wrote a script and I think it's so useful that it can be put into Debian/Ubuntu based distros by default. How can I offer this, and what should I do?
1
vote
2answers
37 views

An option is not seeing an argument (that is a variable) in bash, please help? [duplicate]

#!/bin/bash counter=2 while [ $counter -lt 19 ] do username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1 psswd= head -n $counter ./user_sheet.csv | tail -n 1 | ...
-1
votes
1answer
78 views

Different outputs when using break in bash

I wrote a simple script: for DIR in /etc/*; do if [ "$DIR" == "/etc/dhcp" ]; then echo $DIR break fi done This works correctly but if I use break after fi it doesn't generate ...
2
votes
0answers
49 views

How do I execute a command on system start in Ubuntu 18.04? [duplicate]

According to linuxaudio.org, I should add the command echo 3072 >/sys/class/rtc/rtc0/max_user_freq to my startup scripts. In previous versions, I've done this by adding the line to the file /etc/...
0
votes
0answers
19 views

Python script not running when called from run-parts through a USBmount

I'm running Ubuntu Server and have a python script I am trying to have automatically run when a USB drive is plugged in, however the script is not run when usbmount executes its run-parts command. If ...
5
votes
4answers
134 views

Change dynamic wallpaper directory every season

I want to have my wallpaper be seasonal (summer, fall, winter, spring), but also update daily with a seasonal themed wallpaper. So essentially, I am thinking of having 4 directories (summer, fall, ...
1
vote
0answers
40 views

Adding custom icons to activity bar?

I've got a couple of scripts which periodically display a message with notify-send after running their respective commands. This works well, but I was wondering if there is a relatively easy/...
0
votes
0answers
50 views

Problem with BASH file (bad interpreter: No such file or directory) [on hold]

Apparently someone changed the bash file paths related to python. Showing these messages: $ type -a python bash: type: python: not found (python 2.7; python 3 & python 3.7 are installed) $ aws ...
0
votes
2answers
81 views

Is it possible to get text from a website in terminal

I would like to get a timetable from my schools website and use it in a script to set automatic alerts but I don't know how. So it seems my school uses FullCalendar to set the timetable so the times ...
0
votes
0answers
10 views

Socat executing commands with arguments

I have a socat running on my ubuntu and I need it to execute a bash script with the input from the tcp stream as arguments for the script. For example, if the client sends "-l -w" then the socat ...
0
votes
0answers
22 views

'systemctl suspend' seems to hang and doesn't execute script in system-sleep

I have some trouble with suspending ubuntu 18.10. 'systemctl suspend' seems to hang waiting for the network and not reaches a state where executables in '/lib/systemd/system-sleep' are called. I try ...
0
votes
1answer
51 views

Run a script on boot

I have a script to start a java application automatically. # colors red='\e[0;31m' green='\e[0;32m' yellow='\e[0;33m' reset='\e[0m' echoRed() { echo -e "${red}$1${reset}"; } echoGreen() { echo -e "$...
3
votes
0answers
43 views

Get ok message when installing deb with apt in terminal (from context menu or click)

I find apt in terminal as the best way to install a program from a deb package. As I prefer it to other gui tools, I want that in the context menu for deb files or as a launcher among applications in ...
0
votes
0answers
21 views

How to do one to one mapping in shell script? [duplicate]

Dear Ubuntu Help desk, I am having two arrays namely X and Y of size 1:10, I need to read each values from two arrays [X(1),Y(1)] and [X(2),Y(2)] likewise. Kindly help me out how to write a shell ...
0
votes
0answers
28 views

Scripting with multiple tasks

Clarification this is Homework I don't just want an answer but to know how to in the future as well. Write a script (called phone_num.sh) that does these tasks: Read the phone numbers in the data ...
1
vote
2answers
43 views

How can I move content of a txt file to another using Bash Script?

I want to copy the whole content of the file into another multiple files as group wise. Suppose If I select 10 .txt files then the contents of those files should be copy and paste in a another one new ...
0
votes
0answers
23 views

How to put special characters with lynx script?

I'm writing a script to send any code to a page by making the lynx to type it completely but I don't know how to make it print some special characters: '*' , key * doesn't work '\t', key <tab> ...
0
votes
0answers
26 views

Wallpaper rotation with python and cron [duplicate]

I've written a small piece of python which generates a list of eligible wallpapers from my art collection and then sets a random one to my desktop background. The code works, and if I run it manually ...
-2
votes
0answers
31 views

Awk has a command line option I see [closed]

Used in lots of examples "--cpp", I cannot find a reference to this option in any of the man pages, is there a reference for it or documentation?
0
votes
0answers
24 views

How do I assign a variable in tcsh whose name is expanded ($) from another variable?

I have a part of script as below set n = 0 while ( "$n" <=10 ) @n = $n + 1 set name_$n = (`sed -n "$n"p name.txt`) end I want to add this line under cycle: set inst_$n = (`cat name2.txt |...
1
vote
1answer
52 views

Assigned variable for pipeline is not working

I have a shell script to check port status. After checking the port if it is busy then will kill it. #check port and kill checkPort(){ check=$(sudo netstat -nlpt | grep 2020 | awk '{print $6}') ...
0
votes
1answer
24 views

Changing text on a file using scripts [duplicate]

I want to change the PASS_MIN_DAYS = (whatever value is set) to PASS_MIN_DAYS = 15 using a script.The file it's in is /etc/login.defs.
-1
votes
0answers
15 views

Script to delete users not on a text file [duplicate]

I have a list of users I want to keep on my computer, but I want to delete all the other users with a script. Can anyone help? I'm new to scripting. Make it so only users greater than 10000 get ...
-1
votes
0answers
24 views

I cant get cron to work [duplicate]

sudo crontab -e >> { *1 * * * * date +'%d/%m/%Y %H:%M' >> ultimoscript.txt } My goal is to make a script scriptexample that crontab program me. I want you to write in ultimoscript.txt the ...
1
vote
1answer
69 views

How to write a shell script to check port and kill it?

I have a command to check the port and kill specific pid running on that port. But I want to modify it to, Check port is busy or available If the port is busy then kill the pid How can I do this? ...
0
votes
1answer
36 views

Ubuntu using Linux Subsystem for Windows .sh problem

I'm trying to run a .sh script in my home directory and I get the following error. -bash: ./test.sh: /bin/env: bad interpreter: Permission denied When I try to sudo the script I get a similar error ...
0
votes
2answers
60 views

How to separate fields? [closed]

I want to write a script to separate fields. Output should be like this: 192.168.94.139 middle of loop 192.168.94.140 middle of loop There are two variables (servers) under $SERVER_SELECTION ...
0
votes
0answers
15 views

Bash script to automaticly change a given user's password [duplicate]

So, I know that the passwd command allows me to change my own password, and if run with sudo, allows me to change anyone's password, but what if I want a script to do it? I have a script that grabs a ...
0
votes
0answers
54 views

First bash script: computer to dropbox backup help

I have the following script in /.backup with a symlink to cron.weekly. The goal is to have my entire system encrypted, compressed, and saved to dropbox every week. This is my first bash script and I'm ...
0
votes
1answer
46 views

Setting environment variable for different tabs using gnome-terminal

In order to set up a number of applications, I'm trying to do something similar as: gnome-terminal \ --tab "app1" --working-directory=dir1 -e "export app=1 & npm start" \ --tab "app2" --working-...
0
votes
0answers
20 views

Can we run shell scripts which are located in gitlab from Jenkins

I have a Jenkins parameter job to deploy artifacts to the remote server. I wrote a shell script to check whether there is a directoy called backup in /var/www/test.com path if not create a directory. ...
1
vote
2answers
48 views

Create a file to automatically check user list for users specified

I am realitively new to bash scripting, but have created this from my intense googling I am attempting to create a bash script to run on Ubuntu that will check the user list and find any users that ...
1
vote
1answer
37 views

how to set umask permissions mask to 777?

I'm interested in creating a shell script that is capable of creating various operations (creating files,users, groups and more), and for that it's necessary to change the permissions mask.
2
votes
1answer
36 views

how to create a regex string where you don't know what to escape

I have a passwd file with the line containing root being: root:6UZSjeWUui3JQ:0:0:root:/root:/bin/sh I want this line to be changed to: root:$1$dog$cNv/OuAd7CMNdrhWsHXAR.:0:0:root:/root:/bin/sh ...
1
vote
1answer
61 views

trying to write bash script that sends email with output from two variables ubuntu 18.04

The problem I am having is that the action I am looking for is for sendemail to send myself an email that contains both w output from the ssh user and output from doing an lsof -u on $SSH_USER to see ...
1
vote
1answer
36 views

argument not recognized for-loop

I'm new pretty new when it comes to creating scripts in linux (I also don't really know on which terms to use like bash/shell), but I have the following command in a script which I want to execute ...
0
votes
1answer
20 views

cron processing only half of script

script: curl -s http://api.ipify.org > ~/ip.txt && [[ -s ~/ip.txt ]] && ip=$(cat ip.txt) && echo $ip > ~/newIP.txt || echo WAN IP is blank: curl, latency or internet ...
2
votes
1answer
103 views

read input from a file and append that values to variables using shell

I'm trying to write a bash script to read a file as input and append the values/data in that file into variables and the values of the variables should be updated each iteration based on the input ...
1
vote
1answer
49 views

Command not found after setting source in bash script [duplicate]

Following the instructions here, and everything works fine manually. However, when I use the instructions in a bash script, I get rbenv command not found because the source ~/.bashrc didn't execute ...
2
votes
1answer
42 views

Save all command and all output (using script across terminals)

For a short period of time, I want to save the command history and output of every command I run in any terminal I open. It should all go in the same file. So basically I want to run a command (or ...
2
votes
2answers
113 views

Script for merging files in multiple nested directories by symbolic link

Basically I am looking for a script to automate stuff (See picture below) in Ubuntu. I'm thinking of using a bash script but other solutions (eg. python?) would also be excellent. 1) Suppose I have a ...
0
votes
1answer
29 views

Script for creating users on new servers

So I am in this situation where we have started adding a bunch of new servers because we are getting new clients, therefore, we need new servers for each new client we get, and with that follows the ...
0
votes
2answers
49 views

How to write a script that automates an user setup in Linux using Ubuntu? [closed]

Hello I'm asking for assistance creating a script that automates an user setup in Linux Server using Ubuntu? Also, how to create a script that backups shared files every 12 hours?
0
votes
1answer
24 views

Running python script from shell script with newline

I have a python code that I want to run from the shell script. This one works python train.py --dataset './datasets/lausanne' --timestep 30 --obs_len 8 --loader_num_workers 1 --num_epochs 100 --...
0
votes
0answers
6 views

I need help to log process details for every 5 minutes for each disk or media vise. can some one help?

Basically I need to have a logging enabled for disk wise information of processes which are utilizing that perticular disk at given point in time. and I want that log at single place. can some one ...
0
votes
0answers
19 views

Reading system varibles in script

I am trying to read a system variable that is XDG_CURRENT_DESKTOP from a shell script. echo the variable in terminal works fine. but when running it within a bash script it echoes empty due to that ...
1
vote
3answers
82 views

How to write a script that backs up printed documents every 6 hours?

I am currently working on a project where I have to build a Linux network on a virtual machine using Ubuntu 18.04. I am currently trying to figure out how to write a script that backs up the printed ...
0
votes
0answers
30 views

How can I auto-close an urxvt terminal after executing an expect script?

I've written a script to handle quick copying of passwords to the clipboard: #!/usr/bin/expect -f spawn -noecho zsh expect "$ " send "pass show -c " interact exit This script is launched like this: ...
0
votes
1answer
51 views

Spaces missing from strings in an Bash array

I found a strange thing and will be nice if somebody can help to fix it. #!/bin/bash # dockerdir="docker" step_1=("nginx" "create" "default.conf") step_2=("nginx" "use" "default.conf" "replace" "...
1
vote
1answer
29 views

Execute sudo Bash script as another user while being root

I am logged in as root and want to execute a Bash script with sudo permissions as another user. This is the test Bash script in /home/me/sudo.bash: mkdir -p /etc/test # Creating an /etc directory to ...