scripts

Timer program that plays 4 sounds one after another for 30 seconds each

Timer program that plays 4 sounds one after another for 30 seconds each Could someone help me. I need a bash script to play a short sound file, wait for 30 seconds, play another sound file, wait for another 30 seconds. (I will use it as a reminder to spend 30 seconds on each quadrant …

Total answers: 2

Should we put file names in Bash in Quotes or Double quotes? What is the standard?

Should we put file names in Bash in Quotes or Double quotes? What is the standard? Should we put file names in Bash in Quotes or Double quotes? What is the standard? SRC=file or SRC=’file’ or SRC="file" ? Asked By: fsgdfgdfgd || Source There is no "standard" according to the Bash Reference Manual. Variables (Shell …

Total answers: 4

ask user to enter input such as their age and save it to a variable

ask user to enter input such as their age and save it to a variable Im trying to make a simple bash script work as a beginner exercise where im asking a user to enter their age and the script should echo depending on their input "You are old" or "you are young" if they …

Total answers: 2

I have a simple script that ask for my pass when it shouldn't

I have a simple script that ask for my pass when it shouldn't I have this simple script /home/myuser/startup.sh #!/bin/bash # sin le pongo -x al final va tirando por pantalla todo lo que hace echo "Finding PIDs of mysql processes…" mysql_pid=$(sudo lsof -i -P -n | grep ‘mysql’ | awk ‘NR==1{print $2}’) echo "Check …

Total answers: 1

Bash: is there a way for program/script to run on foreground at specific timing

Bash: is there a way for program/script to run on foreground at specific timing As the above question, is there any program that we can use to run another program/script at foreground. I know that I can run a program as background job at specific timing using at. at 09:00 -f bashscript.sh What essentially I …

Total answers: 1

How to use variable in Find and grep command?

How to use variable in Find and grep command? find command to get files have part of their names as date ($Y variable that has date in the script) Y=(date -d "1 day ago" "+%Y-%m-%d") find /log/bssuser/CDR/Postpaid_CDR_Log/ -type f -name ‘*log_LOG_POSTPAID_CDR’*$Y*.log | grep -H ‘^ORA’ ‘log_LOG_POSTPAID_CDR’*$Y*.log when run this command I got the below error: …

Total answers: 1

Rename file as computer serial number

Rename file as computer serial number Is it possible to rename a file to computer’s serial number via terminal shell/script. Example: I have a file at /home/ladmin/Documents/ExampleFile123.txt and I want to rename it as PCSerial_Example123.txt. I am able to get the PC Serial Number with: sudo dmidecode -s system-serial-number But I don’t know how to …

Total answers: 1

How to automate opening files one by one and then prompt to delete?

How to automate opening files one by one and then prompt to delete? Full disclosure I am a total noob, I started using ubuntu 3 months ago, loving it so far. Here is the problem I have a folder containing over 800+ images, I want to go through each one of them one by one …

Total answers: 1

Hard Disk Reference in Shell Scripts /dev/sda & /dev/nvme0

Hard Disk Reference in Shell Scripts /dev/sda & /dev/nvme0 I have two types of computers, on one hard disk type is NVME while other is generic hard disk. I have a script to format the disk and then clean /wipe the disk with Scrub. sudo mkfs -F /dev/nvme0n1 sudo scrub /dev/nvme0n1 On generic hard disk …

Total answers: 1

wsl -e cannot run a script that I can run when wsl has been executed

wsl -e cannot run a script that I can run when wsl has been executed I created a file in Ubuntu called bash_test_01.sh containing the command echo "cmd is executed" in Powershell, if I run >wsl $cd /home $/home/adm_difolco_e/bash_test_01.sh I get cmd is executed. However if I run wsl -e /home/adm_difolco_e/bash_test_01.sh I get <3>WSL (31608) …

Total answers: 1

Loop through file extension Annotate add EXIF Rename and Copy

Loop through file extension Annotate add EXIF Rename and Copy This script, reads user input from an entry like filename.jpg it creates a directory inside the current directory. Then renames the file and adds the files EXIF data it then copies the original file to the directory that was just created. Using convert from imagemagick …

Total answers: 1

When installing, command in `postinst` always results in `$?` = `0`

When installing, command in `postinst` always results in `$?` = `0` I have a postinst script in my debian package: #!/bin/bash oqm-config -g system.hostname RESULT="$?" if [ "$RESULT" -eq 1 ]; then oqm-config -s system.hostname $(hostname).local "." fi This is intended to populate a config variable (if it doesn’t exist). These commands function outside of …

Total answers: 1

Two-way pipe in bash?

Two-way pipe in bash? I have a binary who’s stdout is being redirected to the stdin of a python script, and I was wondering if there’s any way to send the stdout of the python script to the stdin of the binary, to get an effect something like this, (excuse my terrible ascii diagram): |->-binary …

Total answers: 1

Bash script – new Konsole closing

Bash script – new Konsole closing I’m working on a project that requires me to open some new bash windows to start the docker, server, etc. of the project. I’m trying to make a script so I can start things faster. So far I have this: #!/bin/bash cd dev/proj/prod/; konsole –hold –new-tab -e echo "Hello …

Total answers: 1

Bash script with different CWD from parent shell?

Bash script with different CWD from parent shell? I’m doing a puzzle for my computer science class where I need to execute the binary /challenge/executable via a shell script, from the CWD of /tmp/exampledir, with the shell’s CWD being a different directory from the shell script’s, or as the challenge phrases it: the challenge checks …

Total answers: 1

Use an array as argv?

Use an array as argv? In a bash script, I’m calling a function with a large number of arguments, say for example /bin/meaningoflife takes 42 arguments. Is there a way I can pass an array to a command instead of manually entering in all of the 42 arguments? For example: arr = ("arg1", "arg2", "arg3") …

Total answers: 1

linux script: '. /path/to/anotherscript'

linux script: '. /path/to/anotherscript' I have a script file which refers to another script file(containing some functions) this way: . "${scripts_dir}/update.sh" What does it mean in linux scripting? Does it load code in update.sh so that it can be invoked now onwards? Asked By: Mandroid || Source . is a command (!) that sources the …

Total answers: 1

Unable to run notify-send from cronjob

Unable to run notify-send from cronjob In my Kubuntu 22.04, a script run by my crontab uses notify-send. However, it doesn’t work: there is no pop-up appearing. If I redirect the output (stderr in particular) of the script to a file, this error is printed: Error calling StartServiceByName for org.freedesktop.Notifications: Timeout was reached If instead …

Total answers: 1

Cron Job created by script to run another script on reboot – not working

Cron Job created by script to run another script on reboot – not working I’m trying to have a script create a cron job that executes another script on reboot. For reasons I am yet to understand, I cannot get this to work. For the sake of simplicity, this is the snippet I cannot get …

Total answers: 1