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
-2
votes
1answer
44 views

Note down the number of times the condition is true

I was trying to write a shell script and my requirement is if my condition is satisfied then it should note down how many times my condition is satisfied for example in below code when the VAR ...
0
votes
1answer
45 views

Adding printers via lpadmin in script

I was wondering if anyone could help me figure out why printers aren't being correctly added via lpadmin? I'm making a script that initializes new devices in our company quickly, you just input the ...
0
votes
0answers
23 views

Script that e-mails predifined message to multiple users

I am new to unix coding so i need your help! I want to create a script that asks the user for his username and check if its valid by verifying the user home directory exists. If the username exists it ...
0
votes
0answers
22 views

Question about cronjobs/bash scripts which are not executed

I have two scripts which are called via crontab. The first script backs up my database and sends it over to S3. This works seamlessly. I have a second script which cleans up old backups. The issue is,...
0
votes
0answers
18 views

Multiple server login by shell script [closed]

i want to login on multiple server by the shell script and i want to check the running process of all server. So how can we login in multiple server by shell script please suggest me ........
0
votes
1answer
25 views

syntax error in conditional expression with bash script

I am running the below script : status="UNKNOWN" while [[ "$status" != "OUTPUT"]]; do echo "Checking status of job $jobid" status=$(zowe zos-jobs view job-status-by-jobid "$jobid" --rff ...
0
votes
1answer
71 views

Cancel buttons Zenity

So, I have this script: #!/bin/sh #InputBox1Test title=$(zenity --entry --text 'Type what you want your Notification Title to Say!' --title 'Notification') text=$(zenity --entry --text 'Type what ...
0
votes
0answers
26 views

Rounding up to two decimals using awk in shell script

I have prepared a shell script in that by division of two numbers. I am getting output as 0.56666666 but the output need to be restricted as 0.56. Below is the code I have used. percent[j]=$(( (${...
0
votes
1answer
113 views

Script misbehaving with scheduled using “at”

I would appreciate advice on why a script would run fine when the script is launched from a terminal command line, but some commands in the script seemingly do not run when the script is scheduled ...
0
votes
0answers
17 views

Installing JAVA 8 using a bash script

I am learning Linux and shell scripting. I wanted to know how does a bash script works to install Java instead of manually writing the commands, make a bash script and execute it so that it ...
0
votes
0answers
31 views

Command `script` in zsh

I want to automatically run script when my shell (zsh) runs. I want it quiet so it does not display I'm entering it nor I'm exiting it when I CTRL-D. I tried to edit .zshrc and added script, but it ...
-1
votes
1answer
48 views

Can we make Executable Scripts to run on any Ubuntu machine?

I am curious to know if there is a way we can execute several terminal commands by double clicking a file. Lets suppose these are the commands I want to execute on a terminal. curl -s https://brave-...
0
votes
1answer
91 views

Why is my BASH script [script] producing a '[script]: command not found' error?

I recently downloaded the newest tor-browser from the tor project. It's a zip, so I extracted it to ~/.tor-browser_en-US/. I ran ./start-tor-browser.desktop --register. Great - now I can open the ...
0
votes
0answers
48 views

notify-send infinite notification

I made a short script to notify myself when my battery is below 25% and above 75%. I'm using notify-send to send notifications and play alert sound as to notify the user of the event. The problem I'm ...
-2
votes
0answers
39 views

running the commands on a script [closed]

export DEBIAN_FRONTEND=noninteractive sudo debconf-set-selections <<< "mysql-community-server/re-root-pass password test" sudo debconf-set-selections <<< "mysql-community-server/root-...
0
votes
1answer
17 views

How I can drag and drop with AutoKey script? or altenatives? (My right click is broken)

Please I need a code script for AutoKey or alternative. I speak Spanish. I need this because my right click is broken and I'm poor.
0
votes
0answers
42 views

Crontab doesn't seem to work

I run my minecraft server in a screen and I have a script set up to restart the server via crontab every night at 3 am. restart.sh: #!/bin/sh echo "Letting people know that the server is going to ...
0
votes
1answer
61 views

Bash script automatitation name change using date

I'm new to the shell/bash area. I've created this little script to change a name using the date command. The idea is to get something like this 1.txt=>2020-02.txt And it works, but I get the ...
0
votes
0answers
33 views

bash: syntax error near unexpected token '('

I am trying to use git for the first time and have been given some code to extract a file name from a MatLab script. I keep encountering this error, and if I remove the bracket after imread it does ...
0
votes
0answers
63 views

bash Script not working with crontab ubuntu server 16

I have made a custom bash script which uses cyberoam Linux client to login into captive portal. #!/bin/bash /home/seg/CyberoamLinuxClient/crclient -u user1 -i ens160 The script works fine as ...
0
votes
0answers
69 views

Add custom packages to end of install script for Ubuntu 16.04 live USB

I have some packages I'd like to install at the end of the installation process for Ubuntu 16.04. What is the best way I can add a command like apt-get install gnome-disk-utility to the end of my ...
2
votes
1answer
212 views

Return Value to Python script from shell

I'm trying to return a string from shell script to python getting the below error. ./whiptail.sh: 10: return: Illegal number: uuiiu i tried running the whiptail command within python directly using ...
1
vote
1answer
26 views

define vim key mapping for user defined bash function

I defined a bash function in my .bashrc file, "myfun" for example. Now I would like to execute this function inside vim function vimfun(filename) execute '!myfun' '%' endfunction and I want to ...
0
votes
3answers
50 views

Batch file rename

I have a number of video files with filenames like F_S1_0001.mp4 F_S1_0002.mp4 in a directory, I want to rename them with filenames like 1_S1.mp4 2_S1.mp4 and save in a new directory by writing a ...
2
votes
2answers
90 views

Open terminal with multiple tabs and execute application which uniquely modifies PS1 variable for each tab

What I'm trying to do: Write a script to open 3 tabs. cd into a different folder in each tab (ie: run a unique command). get each tab to have a unique title by modifying its local PS1 variable ...
0
votes
2answers
36 views

if command is true for X seconds run code in bash shell script

i want an if statement to only run if the condition in the statement is true for at least 3 consecutive seconds, how do i achieve it in linux bash shell script? i haven't done it before, and couldn't ...
1
vote
1answer
60 views

bash: “command not found” when calling function defined in ~/.bashrc file in `bash -c` command while opening gnome-terminal tab

What I'm trying to do: Write a script to open 3 tabs. cd into a different folder in each tab (ie: run a unique command). get each tab to have a unique title I want this scripted so I can click ...
0
votes
1answer
35 views

Assign Semi Path to a variable

How can i assign only the first 4 words of a path to a variable for example: my current working directory is /home/Foo/Documents/Programs/ShellScripts/Butler and i want assign a variable with path ...
0
votes
1answer
29 views

How can i make a script to open Winbox Wine easier and faster

Now when I tried to open Winbox, I have to : Open Terminal cd /home/xxxx/Downloads wine winbox64.exe All I want is just put some executable or icon that we can put it at Favorites or Desktop and ...
0
votes
0answers
63 views

Create startup script from scratch

I know this might be a simple question, but I want to create a file to run the following command at system startup, because every time I restart the OS the changes made by the command are reset: ...
0
votes
0answers
34 views

Check before and other commands in a custom script?

I want to create a script that downloads the archive of the latest firefox from mozilla site. But I want a few other things that I don't know how to do. First thing here is the script: #!/bin/bash ...
0
votes
1answer
41 views

Automatic transfer of clipboard copied text to some text file

I want the text copied from the mouse (clipboard or X selection), or copied with Ctrl+C, to be automatically transferred to a text file. I am using a very good website for subtitling videos called ...
0
votes
1answer
36 views

How to create a icon to execute a script?

I installed an android-studio on my machine. But I only need the emulator, not the whole android-studio. I can run my emulator from Terminal using the following command cd /home/bmshamsnahid/Android/...
0
votes
1answer
56 views

check if a file exist with -f and convert the result into variable

trying to make the follwoing command to look for a full fine name work correctly but i can't for now. The command i use to look for file "Lista*": PathFileIN_Elab=/root/Testms/Files ChkFileName="$(...
0
votes
1answer
61 views

What does the variable $SHELL do, entered without any command?

I know that $SHELL is an environment-variable, which refers to the current default-shell. echo $SHELL prints the path to stdout. Here the use of it for keeping the terminal window open: How to run a ...
0
votes
1answer
56 views

Return error of [: illegal number: 100k

I run a program which a program in Ubuntu terminal with input as follow 100k ExampleFile ~/ and program code #!/bin/sh #!/bin/bash ​ echo "File size you want to archive" read size ​ ...
-1
votes
0answers
14 views

getting the error “ goaudit service dead but subsys locked ”

/usr/sbin/goaudit Stopping auditd: [OK] Failed to flush existing audit rules. Error: exit status 255 did all the basic things like removing pid and checked subsys file ..all done.. i am unable to ...
0
votes
2answers
52 views

Error on Integer Expression and Unary Operator

I build a program and execute in in the Ubuntu terminal. Below is the code: #!/bin/sh #!/bin/bash echo "File size you want to archive" read size echo "File name to archive" read name echo "Path to ...
0
votes
0answers
18 views

Infinity footpedal compatibility issue

I'm very new to Ubuntu and IT in general, so I am sorry if I'm asking a basic question! I have looked over various posts and haven't found a solution to my issue. I do transcription on Express Scribe ...
0
votes
0answers
29 views

Zfs bash script only make empty folders at destination, how can I send files there?

Why does my script only make empty folders with no content? newbie at zfs & bash #What Files or Folders to Take Backup of. backup_files="/home/clas/Pictures/minime.jpg" # Destination of Backup. ...
0
votes
2answers
84 views

move command not working in bash script

I tried to move everything except a few items to a folder using a bash script with the following content. I tried these commands in the terminal first and got the expected results, but putting them ...
-3
votes
1answer
55 views

Uninstalling mailarchiva from Ubuntu

New to Linux here. I installed mailarchiva on ubuntu 19.10 a few days ago, only to discover that Google cannot find any uninstall instructions anywhere for it. In the mailarchiva installation folder, ...
0
votes
1answer
53 views

bash script to back up a directory

I'm writing a script to back up a directory by user and for a specific number of days. I'm new to bash so the fix could be very simple but I can't see it. When I run it return "syntax error near ...
0
votes
1answer
41 views

Run python Script that reruns every 4 hours at system startup [duplicate]

I am fairly new to ubuntu/linux and python so I beg forgiveness in advance. I have a small python script that I typically start in a terminal screen. This script runs a simple task then sets a timer ...
2
votes
0answers
21 views

Lubuntu: autorun after GUI loads, either a script, or a desktop app (with a script)

I am trying to have Lubuntu run a script as soon as the desktop as loaded after logging in. Right now there is a desktop application for a user to double click that runs the script. I would rather ...
-2
votes
2answers
59 views

How to I start ranger directly from my file manager? [closed]

How do I make ranger start directly from my file manager, instead of first opening the terminal and then starting the application? I have written this below code in my .desktop file: #!/bin/bash [...
0
votes
0answers
24 views

Cron hitting script, not executing ZSH zmv command

Ok, I've done a fair amount of browsing and testing, and I still cannot get an embedded zsh script to execute from cron though it works as expected from the command line. I've reviewed posts topics ...
0
votes
1answer
30 views

Shell doesn't run python ONLY when executed by crontab

I have a shell script which runs python then attaches a pdf to an email via mutt. Shell script: cd ./pod_reports/script/ whereareyou=`pwd` OUT=`python3 dummy.py` cd .. filename=$(ls *.pdf -1t | head ...
1
vote
1answer
88 views

Bash script to extract and convert subtitles

I am having some problems setting up a bash script to automate some stuff. What is my problem: I ripped all my BluRays to set up a personal media server (e.g. Emby) for my family. Unfortunately, my ...
0
votes
1answer
42 views

$HOSTNAME returns empty in rc.local script

I'm executing some script on my server startup, using the rc.local file (as suggested on this SQ answer. The script sends an email to my address notifiying me that the server has started up. This is ...

1 2 3 4 5 109