Questions tagged as 'shell-script'

3
answers

Execute Shell Script verifying 32bit or 64bit system architecture

How can I make a script that checks the system architecture and so it would execute the commands for the appropriate architecture, for example: if 32bit; then comandos para 32 bits else comandos para 64 bits     
asked by 08.04.2018 / 22:54
3
answers

html shellscript table

Well, does anyone know how to create this script request in the image below? I'm doing some exercises with the theme, and this medium that got me.     
asked by 27.10.2016 / 01:14
2
answers

Generating a file that is output from a command only if a condition is satisfied

Be the command: top -o %MEM -b > file.txt I would like in file.txt only the values that are between two time periods, such as: between April 7, 2017 07h and April 7, 2017 12h. It's possible? This way, I would have a file with just the...
asked by 08.04.2017 / 00:00
3
answers

Problem creating a .sh script to get into a directory

I'm creating a .sh script that the first step is to get into a directory. 1. #!/bin/bash cd /home/salariosbrasil/consulta-ninja #git pull pwd This directory exists and even cd does not work .. but your self test mkdir -p...
asked by 24.01.2017 / 20:40
1
answer

List file excluding first letter

I have a file called 1arquivo and it usually clears it with the ls command. How can I use ls excluding the first letter so that it returns me only arquivo . It has to be a generic solution because I will have several files in...
asked by 30.11.2017 / 17:49
1
answer

How to list all files in the ".ts" format of folders and subfolders to be converted to ".avi"?

I found a shell script and modified it to meet my need and it looked like this: #!/bin/bash [ "$1" ] && cd "$1" ls -1 *.TS [ "$?" -ne 0 ] && echo 'Sem arquivos TS nesse diretório' && exit 0 for ARQUIVO in $(ls -1 *.TS)...
asked by 25.10.2016 / 22:37
1
answer

How do I get size of an array string in the shell script?

I have a string that I pass as a parameter, for example: "2,3,4,5" To get every item of it I do: #!/bin/bash for ((i=1; i<=4; i++)) do echo "$1" | cut -d "," -f $i done But I would like to make the loop iterate up to the m...
asked by 14.09.2018 / 20:00
3
answers

Remove everything after? in file name

Hello I'm trying to rename a large amount of files in linux, but I'm not able to hit the command. The case is as follows: I have several files in a directory and its subdirectories that have the following name format nome_do_arquivo.ext?...
asked by 09.05.2018 / 16:35
1
answer

How to redirect all the bash script inside the script itself?

I need to play the output of it in a file instead of playing in the standard output that is the screen but without having to explicit with the command >> in the terminal, I want the script itself to do this.     
asked by 23.07.2018 / 00:42
3
answers

Replace output of a command with a custom message

I am creating a script where at the end of it I execute a command that displays a very large output of information. Is it possible to replace this output? That is, instead of it showing the standard output show only one message eg Connected. ?...
asked by 21.09.2017 / 14:13