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

Wait Command so Unrar will finish the first .rar then move to next

Below is the command user3140225 helped me out with and it works fine: find /home/username/source/directory/ -type f -name "*.rar" -exec unrar e -o- {} /home/username/copy/extracted/to \; -delete &...
0
votes
1answer
16 views

Download with curl

I am trying to download the .mat files from the pages below with the following script: !for url in `curl -s csegroups.case.edu/bearingdatacenter/pages/12k-drive-end-bearing-fault-data |grep mat |grep ...
-1
votes
2answers
33 views

shell script: cut part of a string

I have following string 11-22-33-44-55-66-77-88-99-1010-1111-1212 I want to extract 88-99-1010-111 from that string
0
votes
1answer
82 views

Shell script ssh to login multiple servers with password passing from a file [duplicate]

Shell script ssh to login multiple servers with passing password from a file for example: Password file name : password.txt and the password is "test123". ssh_script: ssh testuser@testserver &...
0
votes
0answers
18 views

Is there a way to find the ip I am connecting to a server from?

When I connect to a server I want to run some shell scripts to whitelist ip's that successfully connect over ssh. They need the inbound IP address of the ssh connection, not the server's IP. Is there ...
0
votes
0answers
25 views

Tab auto-completetion not working when executing python scripts

Tab auto-completion/double pressing tab does not show files or autocomplete file, only showing folders while executing python scripts with argparse arguments. Expected behaviour: python ~/scripts/...
2
votes
1answer
34 views

flatpak in a script, how to auto answer “Use this remote?”

When trying to install flapaks in a script, $ flatpak install program_I_am_installing I get prompted with Found similar ref(s) for 'program_I_am_installing' in remote 'flathub' (subsystem). Use ...
3
votes
1answer
87 views

Communicating via two bash scripts

So I'm supposed to create two bash scripts for the game "guess my number." One script is for Dealer while the other one is for Player. Each script should wait for the other to generate their ...
-1
votes
0answers
28 views

How do I launch a file as administrator/not using another application to do so? (Ubuntu 18.04) [on hold]

There is a shell file that I want to run but I can't because I can't run it as administrator (as I did previously on Ubuntu MATE) and there is no appropriate application to run it with. Edit: I sent ...
1
vote
0answers
28 views

Not able to connect to linux server using winscp because of login script

I am not able to connect to my remote hosting server using Winscp. I have set the file protocol as SFTP and shell as bin/bash. I am getting the following error after entering the username and password:...
0
votes
0answers
24 views

what does this shell command do? “${f// /_}” [duplicate]

somehow this identifies spaces in filenames and replaces them with underscore, how do I learn how to do this?
0
votes
0answers
23 views

run shell script files in ubuntu

I work on ubuntu 19.04 and want to install Arduino .I can extract the files but I cannot run the install.sh file as it says command not found.
6
votes
2answers
1k views

I don't want my ls command in my script to print results on screen

I run "ls -lX" over files umbrella31_*.xvg. I run a command that searches the number on the fifth column of the ls command output, that is larger let's say than 20000. It looks like this: ls -lX ...
0
votes
0answers
18 views

Strange problem with rc.local not running some commands

I have Ubuntu 16.04. I am trying to run commands in /etc/rc.local, but they are not running correctly. I have enabled rc.local using sudo systemctl enable rc-local.service. I can see rc.local has run ...
1
vote
0answers
46 views

How do I print message and continue if software not found? [closed]

I'm finding that scripts to install software, codecs, etc., abruptly stop if that item isn't found. How do I tell it to install the item if it is found, and if it is not found, print item not found, ...
0
votes
0answers
21 views

Microsoft PSI build failed

I am trying to set Microsoft PSI to work on some machine learning g++ -g -shared -Wl,-Bsymbolic -o Microsoft.Psi.Media.Native.so FFMPEGReaderNative.o /libavdevice/libavdevice.so /libavfilter/...
0
votes
0answers
18 views

Having trouble with rdiff-backup

I'm having trouble with automation of rdiff-backup. There are 2 issues right now. Script itself: #!/bin/bash ​# This is backup script for rdiff-backup # Backup command ​rdiff-backup --include-...
0
votes
0answers
24 views

Converting multiple txt files within director subfolders into useful consolidated csv file with appropriate column names [closed]

I'm attempting to do the following from the Terminal Command Line: Convert text file (allMovement_Regressors.txt; 12 columns; 548 rows) in each subfolder of a Directory into csv files stored within ...
0
votes
0answers
16 views

I have accidentally closed my mouse & touchpad option and how can i enable it with or without terminal? [duplicate]

I am not able to use my mouse and touchpad because i accidentally, turned off the touchpad option on ubuntu 19.help me out guys
12
votes
4answers
1k views

Pass a bash variable to python script

I have this python script: #!/usr/bin/env python def getPermutation(s, prefix=''): if len(s) == 0: print prefix for i in range(len(s)): getPermutation(...
1
vote
1answer
66 views

How do I remove special characters from file name with a command?

I have a few files that I want to rename and want to accomplish this in the command line. I need to remove these characters "¡¿" from the beginning of the file names. From this: ¡Tú_la_llevas!-2018....
0
votes
1answer
41 views

update hosts file on boot

I'm trying to fix a problem where sudo takes a few seconds if the hostname is not in /etc/hosts. this works from CLI: sed -i "s/ubuntu-template/$HOSTNAME/g" /etc/hosts but if I save it to a file /...
0
votes
0answers
17 views

Add text to positional parameter

I want to use a command like this echo file.mp4 ~/file.mp4 but what if I wanted to use positional parameter like echo file.mp4 ~/$1 it print file.mp4 /home/roro/ when I want it to print ~/file.mp4
0
votes
1answer
22 views

Run a shell script from another script concurrently in a new terminal window

I'm trying to run a shell script from another and make them display each script's output in a separate terminal window but I cannot. When I run script1 it runs fine and then calls script2 using source ...
0
votes
1answer
33 views

xbindkeys does not work with bash script

I wrote a simple script in bash for light up the Fn led when CapsLock is pressed since the caps button on my t450 doesn't have its own led. So, I have to execute this script at the press of the key, ...
1
vote
3answers
81 views

How to capture terminal output as execution proceeds?

I have tried using all the commands mention in Byte Commander's answer to the question here but they do not work unless the program finishes. I am running a python script like so 'python script.py' ...
0
votes
0answers
23 views

Continue custom kernel creation and not start over again from square one

Task: Create a custom Ubuntu kernel from git sources (in my case hwe-branch). Short summary: I want to fix a error reported by the build scripts and then repeat only the last compilation/packaging ...
2
votes
1answer
29 views

Suspend temporarily linux update apt for the session until reboot

hi everything is in the title, i want to Suspend temporarily linux update apt for the session until reboot reason? when i'm on my mobile phone hotspot i don't want to linux PC to DL GB of data so i ...
0
votes
0answers
16 views

How can I make sound play when I unlock the system?

Before that, I made a script that played a sound when a session starts (it is in autoload). How can I make it the same, but with unlocking?
2
votes
1answer
53 views

Ubuntu Script: do this, reboot, do that

I'm trying to automate some little installation process: List item apt install this reboot apt install that finish some other thing Is there a way to get a script resumed after a reboot OR some ...
2
votes
1answer
59 views

Remove words from a column in a file

I have file which contains something like below 5,test,2019-09-27T11:06:23Z,closed,harshavardhanc,2019-09-27T11:09:28Z,2,2 4,test,2019-09-26T16:56:40Z,closed,harshavardhanc,2019-09-26T16:57:02Z,1,1 ...
5
votes
1answer
157 views

Lubuntu, running script on boot

I'm using Lubuntu 19.04 with LXQt I'm trying to remap the Caps-Lock and Escape keys. I have found the commands I needed to make that happen and I've made an executable script for them. If I run the ...
0
votes
0answers
31 views

How to print data column wise in shell script

I'm trying get some data using github API's and print in a csv file. I'm get output something like below 4 3 2 1 user-1 user-2 user-3 user-4 I'm trying to achieve that the data should be displayed ...
0
votes
0answers
25 views

I can't run my csh-script in Ubuntu

I write sch-script (cm2.csh) and trying to run in Ubintu (c shell installed), but receive error like: bash: ./cm2.csh: /bin/csh/: bad interpreter: Not a directory This is my script: #!/bin/csh -f ...
0
votes
2answers
163 views

running a backup script after dropbox has updated

running: Ubuntu 18.04 (gnome) (also installed xfce4 package, if that matters) cron version: 3.0pl1-128.1ubuntu1 on: amd64 updates: all ...
2
votes
1answer
1k views

Ubuntu for Windows when running script gives mv: cannot stat error

I have a node project that uses child_process to kick off a script. The script loops over files, converts them to image, stores the path to each in an array and returns the array to node. then I ...
-1
votes
1answer
96 views

Define a variable in a shell script

Yes, there are plenty of manuals on how to set variables in a script. But I want to define a variable on script startup. For example, I wish to display on script startup that file, which is x hours ...
0
votes
1answer
35 views

Invalid Operation when attempting to run tcl code

Using terminal, I am attempting to execute a script containing tcl code named myscript.tcl. According to the tutorial I am following, I am to type chmod +x myscript.tcl then run the code using ./...
0
votes
1answer
57 views

Allow a shell script containing sudo to run

I am trying to allow a specific user to run a specific .sh file that has a sudo chmod inside of it. I have followed this guide: How to allow a command to be executed for a particular user without ...
1
vote
1answer
24 views

Forcing an external hard drive to run constantly

Each time I want to use my usb external hard drive for the first time there is a short latency for allowing it to run, how to make it run at all time, so that while for example I watch a movie, stop ...
3
votes
2answers
86 views

How can I run a command when a usb device is (dis-) connected?

I am new to linux, and this is probably a noob question, so, sorry for that. I am using a linux PC in my workshop, and I would like to automate the workshop. That's why I have installed a power strip ...
0
votes
1answer
45 views

How to enable/disable lock screen from the command line

I want to be able to quickly and easily enable and disable the lock screen. Right now, I have to go to Menu > Preferences > Power Manager > Security then check or uncheck the check box marked "Lock ...
1
vote
0answers
35 views

Standard input to an interactive bash script

I have a bash script that uses a series of prompts from the user (using echo) and stores the input in a variable (using read). The prompts and inputs look something like this: echo "Name of Folder?" ...
0
votes
1answer
47 views

File exists but is inaccessible via script [closed]

I am receiving the following error when trying to display the contents of /var/log/apache2/error_log in a bash script: more: stat of /var/log/apache2/error_log failed: No such file or directory Yet, ...
1
vote
0answers
29 views

Can't get udev rule to work

I'm trying to run a script when my mouse connects. #!/bin/sh echo New mouse speed applied id=17 speed=1 xinput set-prop $id "Coordinate Transformation Matrix" $speed, 0, 0, 0, $speed, 0, 0, 0, 1 ...
1
vote
2answers
65 views

How to only recognise full options from getopt in a Bash script

I'm writing a Bash script to parse command line options and then execute the desired function. #!/bin/bash TEMP=`getopt --longoptions help --options h --name 'script.sh' -- "$@"` if [ $? != 0 ] ; ...
0
votes
0answers
19 views

Executing script with systemd file yields other results than with the terminal

I created a systemd file to execute a script which launches a Java .jar file. Systemctl status servicename shows an error while the same command in the terminal doesn't. ${VERSION} is set with a .conf ...
2
votes
1answer
33 views

How to print only part of output

I'm kinda new to shell scripts and I'm struggling to get only the information I need from a command. I'm executing this script: #!/bin/bash myfunction(){ find . -name '*' -exec file {} \; | grep "...
0
votes
0answers
43 views

Echo ~/.bashrc PATH from a bash script

I have mybashscript.sh: #!/bin/bash -i alias brc='source ~/.bashrc' source /usr/local/MYPROGRAM/bin/myapp #exec bash echo "******************pathhhhhhhh************" echo $PATH echo "***************...
0
votes
1answer
29 views

How do i work with filenames with whitespaces in linux script?

I'm trying to use filenames loaded from a directory. It works fine but once the filename has whitespaces it doesn't work. I'll demonstrate: Assume your in folder scriptExample with three filename ...