Questions tagged as 'bash'

1
answer

Check if a file is a device file

The exercise consists of evaluating the files contained in a directory, depending on whether they are: Directories Executable Device Regular files My moment code is this: # Clasificamos el contenido del directorio # Contad...
asked by 14.05.2017 / 01:23
1
answer

Problem compressing files with tar

The command tar -cvfz archivo.tar.gz fichero1 fichero2 fichero3 It returns the following error: tar: archivo.tar.gz: No se puede stat: No existe el fichero o el directorio tar: Exiting with failure status due to previous errors I do no...
asked by 17.11.2016 / 22:05
2
answers

Run script using system variable

I have a simple script in bash : #!/bin/bash echo "Hello world" And he executed it on my console with a simple: user@host: $ sh script.sh Hello World That said, I would like to execute the above ( sh script.sh ) by means o...
asked by 23.11.2016 / 02:28
2
answers

View the date of a set of files

I'm trying to make a script that checks the date of the files of different directories and if they are older than 7 days since the last update send me an email. To begin with, I would like to know how I can extract the date from the files. I...
asked by 08.05.2016 / 17:16
2
answers

How can I add a counter to my script

I'm working on a script that gets information from a log called ip.txt and contains the following: 192.168.7.x OK 192.168.9.x OK 192.168.5.x OK Looking for help, I managed to make it print a status depending on the file if all the IPs have...
asked by 04.01.2019 / 02:55
1
answer

how can I capture in an array the text of a line from a txt file? in the shell

I want to capture the text of each line of a text file example text Finally, I indicate that if we invoke the command without counting options (count lines, words, etc), the command will directly return four columns: the count of words, lines...
asked by 02.08.2018 / 21:20
1
answer

Edit file from bash [closed]

I ask for help, I must multiply a number within a file, for a fixed value, from bash, the file has the following form, thank you very much.     
asked by 22.07.2018 / 20:20
1
answer

save in variable values of grabc

How can I save the RGB values of grabc in variables? grabc -rgb or this other code: xwd -root -silent | convert xwd:- -depth 8 -crop "1x1+$X+$Y" txt:- | grep -om1 '#\w\+'     
asked by 24.07.2018 / 05:27
2
answers

Find an exact name in a text file with Bash

I am writing a Script in which one of the functions is to search in a text file DNI or Name that the user is asked for and when he finds them he will print the whole lines. The file has the format "DNI | Name" 2:Pepe 21:Julio 1:Marta...
asked by 10.04.2018 / 21:48
1
answer

Write in a text file the result of a command in Ruby

I am trying to write the result of a command in a text file but I can not write anything. This is my code f directorio2 == nil directorio2 = 'pwd' directorio2 = directorio2.to_s end puts "#{directorio2}" system "diff -rs #{directorio1...
asked by 03.05.2018 / 14:06