As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [scripts]

A script is a program or sequence of instructions written in a plain text file. The script interpreter (for example Bash, Python, Perl etc.) reads the file and carries out the instructions as if they had been entered at the command prompt. Use this tag for all questions related to creating, troubleshooting and running scripts.

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

.desktop file to launch shell script (ROS, kitty)

I have a large launchfile that does a variety of stuff. (fulllaunch.sh) It starts up multiple ROS launchfiles and roscore. But independent of its actual code, i want to be able to start any .sh with a ...
Florian Schneider's user avatar
0 votes
0 answers
12 views

Ubuntu general user mkdir testing

I have generic question about testing mkdir command,firstly I dont have root access, I am user xyz , I will create mkdir dump && chmod 777 dump , now is there a possibility in linux where i ...
shekhar's user avatar
  • 787
-1 votes
1 answer
30 views

Winexe error NT_STATUS_LOGON_FAILURE executing script from Linux to Windows Server 2012

I've installed winexe on my linux machine. I want to use it to execute some script on a Windows Servre 2012. It doesn't work, the error is NT_STATUS_LOGON_FAILURE. I've followed this guide to install ...
dario59's user avatar
  • 11
0 votes
2 answers
45 views

Adding simple shortcut on the terminal, the right way

I am trying to add folder to PATH variable (for specific user only). so to ~/.bashrc i have added export PATH=$PATH:/home/username/Tools/scripts/ within this folder i am having scripts and some ...
TeslaS's user avatar
  • 1
0 votes
1 answer
38 views

How to put sudo operations (apt-get) on a shell script? [duplicate]

I am doing several operations installing packages etc and one of those are sudo apt-get update && apt-get install -y curl obviously it asks my password. Now, I would like to put all the ...
KansaiRobot's user avatar
0 votes
0 answers
13 views

How to run a powershell script to generate exe in ubuntu with ps2exe package

How to make powershell script to generate exe in ubuntu with ps2exe package. My script is working fine in Windows OS but the same script not working in Ubuntu. I need to run this script in Ubuntu ...
Bhavneet Singh's user avatar
0 votes
1 answer
63 views

Any user can change roots' crontab

I wrote a simple php crontab management program that updated the crontab of 'someuser' like so crontab -u someuser /path/to/new/cronfile however I was in need to run some php scripts as root so I ...
magicsux's user avatar
  • 101
-2 votes
1 answer
95 views

Error concatenating directory path in a bash script

I have over-complicated this problem with if/then scripts and super simple one line commands but for some reason I keep getting stumped. I am trying to create a new directory a-e and place the files a,...
tmoney's user avatar
  • 1
1 vote
1 answer
38 views

.desktop files to launch shell scripts

I am trying to create two .desktop entries to launch shell scripts. the shell scripts fullLaunch.sh and tracepen.sh should be executed. Both run when launched from the terminal. They launch multiple ...
Florian Schneider's user avatar
1 vote
1 answer
84 views

Ubuntu 22.04 jammy run script on resume

When i wake my laptop from sleep the sound doesn't work but pulseaudio --kill && pulseaudio --start fixes it. I want to run this as a wake up script. A good search reveals that the trick is to ...
fossilised9uhdj's user avatar
0 votes
1 answer
79 views

How to fix this error in cp?

#!/bin/bash SrcDir=$1 DstDir=$2 #If DstDir is not exist, this creats it if ! [ -a $DstDir ]; then mkdir $DstDir fi #Formats Vformat=(mp4 avi 3gp mpeg mkv wmv mov) Iformat=(jpg jpeg png) Year(){...
UnitedKingdom's user avatar
0 votes
2 answers
65 views

How to remove null in find when no file does match?

How to remove null in stdout of find when no file does match? Vformat=(mp4 wmv pgep mov) for File in ${Vformat[@]} do find $SrcDir -iname "*.$File" | xargs ls -l --time-style=full-iso ...
UnitedKingdom's user avatar
1 vote
0 answers
41 views

Getting the URL of the curent active tab in Firefox

I'm trying to write a script where I can run mpv [youtube link] to watch youtube videos. For this I would like to detect the current active tab on Firefox and fill in the youtube link with it in the ...
XYZ's user avatar
  • 11
0 votes
0 answers
55 views

Help me to develop a .sh script to start a simple task

I want to connect to a server through AtlasVPN automatically. @user: $ atlasvpn connect 1 - Standard 2 - Streaming 3 - SafeSwap 4 - MultiHop *(IT IS NOT ANOTHER LINE)* Enter a number corresponding to ...
Calma Flamma's user avatar
0 votes
1 answer
132 views

Unzip a file as soon as it is downloaded

Do we have any utility (or) can we write any script such that if any zip file is downloaded, it is immediately unzipped and the zip file is deleted.
DynoMonster's user avatar
0 votes
0 answers
55 views

Automatically input text ( sript ) when the terminal open

I have script to mute sound: pactl set-sink-mute 0 true Tt's working if I run directly in terminal but if I make file.sh or run in crontab: * * * * * pactl set-sink-mute 0 true I get error. Is there ...
adrian's user avatar
  • 27
0 votes
1 answer
31 views

Issues launching SpiderOakONE on Ubuntu 22.04 LTS using Cron

I have an instance of Ubuntu 22.04 LTS running on a server. I need SpiderOakONE to launch automatically on reboot without the user having to log in. I decided this would be best suited to cron. I ...
Joe Moore's user avatar
  • 119
0 votes
1 answer
25 views

Concatenate multiple trimmed videos FFmpeg

I am a rooky in FFmpeg and I am trying to concatenate multiple videos that must be trimmed into a new video, the command that I am trying to use is: ffmpeg -i 00042.mp4 -ss 00:00:02 -to 00:00:03 -i ...
ilie alexandru's user avatar
1 vote
1 answer
62 views

Disable Touchscreen Dell XT3 on Ubuntu 23.04

Laptop Make and Model Dell Latitude XT3 Memory : 4 GB Processor : Intel® Core™ i5-2520M CPU @ 2.50GHz × 4 Graphics : Mesa Intel® HD Graphics 3000 (SNB GT2) The Problem Touchscreen becomes glitchy ...
shankar's user avatar
  • 21
0 votes
0 answers
46 views

Call for tail to read /var/log/syslog in a script results in "Permission Denied" in syslog

This script runs when a user connects to my openvpn server using client-connect. When ran, it should check the most recent 50 log lines in syslog to grab the name of the profile that connected. The ...
beekeeper's user avatar
0 votes
1 answer
91 views

How can I execute my custom scripts without typing bash before?

I want to run my custom scripts but every time I need to execute it I have to type bash before the script name. But I want to run it just like we would run other scripts such as ls git sed chmod etc ...
Saad's user avatar
  • 11
1 vote
0 answers
16 views

mkdir: cannot create directory [duplicate]

Hello I have the following bash code: #!/bin/bash arr=( "$@" ) echo "${arr[1]}" echo "${arr[3]}" echo "${arr[2]}" mkdir "${arr[1]}/segments" echo `...
ilie alexandru's user avatar
0 votes
0 answers
70 views

"/tmp/geany_run_script_SO5U41.sh: 7: python: not found" - F5 key doesn't execute script in geany

I'm using Geany for the first time. I'm trying to run the sample script I've written (please see screenshot 1) by pressing F5 - normally, this should open the terminal and execute the code. (According ...
Vadim's user avatar
  • 139
2 votes
1 answer
100 views

Creating HLS Playlists (M3u8) Using FFmpeg

I created my own bash script that will create videos on demand with different resolutions and bit rates. I used "ffmpeg" tool do that, "ffmpeg" is a must, hence I can not use any ...
ilie alexandru's user avatar
1 vote
0 answers
77 views

Find command works in terminal but not in automatic shell script

I am writing a script that automatically copies sqlite files from my computer to a USB stick whenever the stick is inserted. It makes a new directory on the USB that takes the hostname of the computer,...
John Tate's user avatar
0 votes
1 answer
57 views

Interact with a terminal UI using a shell script

I want to automate the installation of phpmyadmin using a shell script. sudo apt install phpmyadmin is straight forward but I don't know how to automate the completion of this pop-up. https://i.stack....
Vassy's user avatar
  • 1
-2 votes
1 answer
47 views

Can I get an explanation on escaping shell variables?

I have a C program I am integrating into a shell script. There is a line that gets the time of birth for $HOME using system("stat $HOME | awk 'FNR == 8 {print}' | awk '{print $2}'"); and it ...
j0h's user avatar
  • 14.4k
1 vote
0 answers
58 views

Pass an array to a bash function, syntax error: "(" unexpected

I am trying to pass an array as an input for a different bash file. The main file is: #!/bin/bash arr=( "$@" ) path=`pwd` cd ${arr[0]} read -p "Enter number of videous: " ...
ilie alexandru's user avatar
0 votes
2 answers
66 views

Add system password while running the .sh file

My problem is when my pc start I want to disable mysql service with below command sudo service mysql stop || service mysql stop in both case system is asking for system password so I am entering the ...
Hardik Desai's user avatar
0 votes
0 answers
43 views

How to show "live" progress of ffmpeg process with zenity?

I have a script to cut/trim media files - more details here and here. It includes a line to show the progress of ffmpeg process with zenity. ~$ zenity --help-progress Usage: zenity [OPTION…] ...
cipricus's user avatar
  • 3,002
0 votes
0 answers
31 views

How to show ffmpeg progress with kdialog?

I have found here here a script that provides a GUI interaction in order to trim/cut media files. I have tried to improve it a bit. Now it involves a file picker to select the file, a timestamp window ...
cipricus's user avatar
  • 3,002
0 votes
2 answers
55 views

Bash test command to check files exists not works as expected

I have a simple bash script. I need to check if file exists and then do some actions related to check result. Script looks like: #!/bin/bash productionPackageJsonPath=/var/www/portaldev/current/...
Čamo's user avatar
  • 629
0 votes
1 answer
46 views

Script cant find file in linux subsystem windows

So i have a folder "gib" in my ubuntu root directory. But this line of a script: #! /bin/tcsh -f setenv GIBBS /gib set gibbs = $GIBBS/GibbsCluster-2.0e_SA.pl This always gives error that ...
Harry Lincoln Komol's user avatar
0 votes
1 answer
36 views

run command before script exits

I have some hardware I'm testing with a bash script. #!/bin/bash tshwctl --setdio=65 for i in $(seq 0 1000) do ./adc1 sleep 1 done tshwctl --clrdio=65 If I press Ctrl+C before it is finished the ...
j0h's user avatar
  • 14.4k
1 vote
0 answers
36 views

Is there a way to dynamically set global environment variables for all users, daemons, and background processes?

I have been trying to reach out to an external data source and dynamically assign the payload contents to environment variables on each startup. I've gotten this half working by running a script in /...
Switch386's user avatar
  • 111
2 votes
1 answer
230 views

I cannot set ulimit on subshell

I have a bash script. This bash script needs to be ran every 5 minutes so I created this code block: #!/bin/bash ulimit -n 600000 ulimit -u 600000 echo -e "This is another bash script to run ...
Erikli's user avatar
  • 419
0 votes
0 answers
38 views

Can't run my scripts shell of my app after doing a rsync of data from Ubuntu server 18.04.5 LTS to another Ubuntu server 22.04.2?

enter image description hereI did an rsync of those filesystems /home/ /opt/ /my_application/ /srv/ Did I forget to copy something else (...?), or is it a problem in version of Ubuntu ? I need to run ...
laila B's user avatar
0 votes
0 answers
26 views

Problem with postinst Script

I've written a short postinst Script to create some Directories after my Application has been installed, with the Intention that the Application may create new Subdirectories of these Directories ...
mdolphin's user avatar
2 votes
0 answers
110 views

How to create a script to change the screen resolution? (Wayland)

I just want to make a script to change my screen resolution. I found many guides to do that, but all of them are made for Xorg Display Server users and i could't find one for Wayland. My question is, ...
EndRE32's user avatar
  • 21
6 votes
1 answer
302 views

bash builtin "read" after a pipe "|" doesn't wait for user input

When I curl a script stored on my web server, it endlessly echos a prompt I coded in until I send ^c. All i do is a simple curl https://server/test.sh | bash. This is the code being ran through the ...
FireBADnoFire's user avatar
0 votes
0 answers
36 views

How to run docker commands in java 19

I am trying to run docker commands in java, to create a Dockerfile and create a container out of it. It can be done in another way, but this is what I tried so far: ProcessBuilder processBuilder = new ...
ilie alexandru's user avatar
0 votes
1 answer
238 views

Shell script runs manually, but not with cron

In my sudo crontab, edited with sudo crontab -e, I have: # m h dom mon dow command 40 4 * * * /bin/bash /usr/bin/verify-miab-backup.sh That script is: #!/bin/bash echo `date` > /home/mythbuntu/...
Aaron Whitehouse's user avatar
0 votes
1 answer
32 views

Key sequence off hot key

I want to be able to use something like Ctrl-Shft-T to trigger a seqquence of keys like "tab - tab - down arrow - down arrow - down arrow - tab - space). I used to have a program for this in ...
user1687619's user avatar
1 vote
1 answer
71 views

KDE custom menu action on directories with whitespaces in the name

I created a script that takes different directories paths to merge the files inside them into one directory. I would exec this scrict by custom Kde-Dolphin action menu, so I created this .desktop file:...
Amarabottiglia's user avatar
0 votes
0 answers
31 views

Jenkins build failure for python script in github using ubuntu version 22.04.2 LTS

I created a simple python code in my github repo with the following: import numpy as np import matplotlib as plt a=np.arange(1,5).reshape(4,1) print(a) print(a.data) print(a**2) print(a.dtype) I ...
Rising Sun's user avatar
0 votes
1 answer
69 views

reading multiline output of command into variable in bash script [duplicate]

I have the following line in a bash script: disk_info=$(smartctl -i $disk) where $disk is the name of a disk eg. /dev/sda The output of the command should be many lines long, and I need to further ...
Simon Kepp Nielsen 's user avatar
1 vote
0 answers
67 views

cannot get rc.local to work with simple chown script on ubuntu 20.04

I am a bit of a noob and I have been following this tutorial to setup rc.local on ubuntu 20.04 as I want to change ownership of folder on boot. The script is saved in chownscript.sh and it is: #!/bin/...
ezzys's user avatar
  • 11
1 vote
1 answer
71 views

Need help with inotifywait loop only processing one file

I have created a shell script that runs an inotifywait command. It watches a folder for new image uploads (That comes from a website) and then uses Imagemagick to resize them, move them to another ...
MadsK's user avatar
  • 11
3 votes
1 answer
1k views

How to create multiple files (with different names) in a specific directory all at once in a Linux terminal

My current directory structure ├── index.html ├── src │ └── App.js └── README.md Now, I wanted to create files App.js, Body.js and Footer.js in a new directory named components. So, my final ...
Yogesh Yadav's user avatar
1 vote
2 answers
315 views

Shell-Check failure

I have a problem with my shell script and shellcheck.net. The following script works like a charm, but shellcheck tells me I have to quote variables, but quoting variables in the script stops the ...
maxwatt's user avatar
  • 468

1
2 3 4 5
132