Questions tagged as 'bash'

4
answers

How to validate if a parameter is a whole number in UNIX?

I have to make a script that receives two parameters, of which the second must be a whole number. I have no idea how to validate that. if test $2 =~ "^[0-9]+$" then echo "\nNumero positivo entero" else echo "\nError: El numero $2 no es...
asked by 15.03.2016 / 02:20
2
answers

how to get a process launched from a script not to die when the script ends?

I'm trying to launch a dbus client, programmed using a Python script, from another script launched using a udev rule (which runs as root), and I need this dbus client to remain running when the script ends. The dbus client to launch is: #!/...
asked by 26.03.2018 / 19:18
5
answers

Grab value from a url

I'm trying to make a script in Bash with which I can get a value from a URL. For example, in this url there is part that says "percent", what I need is to grab that number. I honestly do not have much experience in bash, so any help is welcom...
asked by 06.04.2016 / 17:04
1
answer

Can you operate with decimals in Bash?

Is there any way to work with decimals in Bash? Do operations, obviously. I've tried with let , but it always throws me an error with the decimal part. Thank you very much.     
asked by 05.09.2018 / 08:50
3
answers

Regular expressions in Bash

I'm trying to make a bash script, validate a directory using regular expressions, what I have is the following. echo "Ingresa La ruta de tu directorio" read ruta if [ $ruta != '^/[a-zA-Z]$' ];then echo "No has ingresado una ruta valida, re...
asked by 14.02.2016 / 22:21
3
answers

Extract text between two words

As the title says I want to extract the text between two words. For that, it occurred to me to create a system with the command sed that would allow me to substitute what I was looking for then with greep and cut extract it. But the result...
asked by 25.01.2017 / 04:41
1
answer

Script launched from rule udev stays zombie when launching a new process

I'm trying to use a udev rule to launch a dbus client from a script. The udev rule will jump when a pendrive is connected, and execute the script usbdevinserted.sh , which will copy the identifier of the pendrive to a file and launch th...
asked by 31.03.2018 / 22:42
2
answers

Add random string to the name of the files

I'm developing a Bash script that takes all the images I have in the folder and adds a random string before the extension. That random string would be different for each file. The images are something like "01.jpg", "02.jpg" ... And the idea...
asked by 08.02.2018 / 17:41
2
answers

Value returned by a simple order (128 + n)

Good evening to the stack community. I am studying man bash, and in "shell grammar" I have a doubt, which, in principle, is not strictly programming, so if it is considered out of place (I hope you tell me if it is), edit to delete it . Accor...
asked by 21.12.2018 / 00:04
1
answer

Automate permission change tasks

I'm trying to find how to make a script to automate permission changes and then program it with cron. I have created a directory in / home with a group and certain permissions, and I have added the users to that group. As you know, if user...
asked by 22.01.2016 / 00:36