Most voted "shell-script" questions
Shell script is a scripting language
Learn more…262 questions
Sort by count of
-
0
votes1
answer20
viewsOutput redirect
comando | tee -a saida.txt How do I redirect only part of the output of a command?
-
0
votes2
answers241
viewsAutomation of tasks in linux
Well, I already know python and I know she’s very good at working with scripts and task automation but my question is, i can work comfortably with administration and automation of linux and database…
-
0
votes1
answer212
viewsWhat does $@ mean in shell script?
I’m analyzing some functions in Shell Script and came across this code: adicionar_usuario() { USUARIO=$1 SENHA=$2 shift; shift; COMENTARIO=$@ echo useradd -c "$COMENTARIO" $USUARIO echo passwd…
shell-scriptasked 6 years, 8 months ago user41210 -
0
votes1
answer266
viewsSED replace the same case and minuscule occurrences with something
I am trying to replace occurrences "strings that appear in the document" with another value in the '' case; I have the following chunk of shell script code mkdir NOVO for script in *.sql do sed…
-
0
votes1
answer69
viewsEditing file with shell script links
I have a file with 130 links to download via wget, all files are with the listed links such as:…
-
0
votes0
answers48
viewsHow to search for generic text/phrases of a certain language?
I have a hundred ". jade" files that contain several static phrases in Spanish. I want to map and exchange these phrases for dynamic content based only on the type of language (since I don’t have a…
-
0
votes2
answers44
viewsset shell user to call script in Rails
I need to call a shell script from Rails, with a specific shell user. Example: update_response = `#{deploy_dir}/./update.sh` By default my system is using root user. I would like to know, given this…
-
0
votes2
answers131
viewsError of logica shell script
I want to print on the screen a message according to the current time of the day but it always falls on Is, what would be the mistake? It’s 1:00 and I don’t understand what the mistake is.…
-
0
votes1
answer414
viewsMysql commands in Shell Script
I am trying to make a routine to deploy an application, and I came across a problem in shell script, the mysql commands I can’t run inside it, but at the prompt work, which should be done? mysql -u…
-
0
votes0
answers41
viewsLinux Copy file giving replace in content
how could it be done for me to copy a php file via shell script, but replace the contents of a variable? Example: cat config-sample.php > config.php <?php…
-
0
votes0
answers43
viewsWhile and if : Change the while and if checks to varieveis
I am creating a script for automation of a process, but in the script I have to read a directory and insert the content (filename) in a text file and in the while read each line to process the…
-
0
votes1
answer26
viewsArray size in a JSON in Shell Script
I would like to take the size of a vector in a JSON in the scriipt shell but I’m only able to get the size of each vector string, that is, for the example : #!/bin/bash j='{"Nomes": { "nome":…
-
0
votes1
answer376
viewsBlock comments on bash script
I need to comment on a code block and found the following way it worked: <<COMENTÁRIO meus comentários aqui... ... COMENTÁRIO I wonder if this is the right way to do it, I read on a website…
-
0
votes0
answers32
viewsSequential files in shell script
Good morning, I have the following problem: I have many files of format some_X_YZ.txt, being that YZ represents a sequence of days. I want to know how I can check if in a particular folder, with…
shell-scriptasked 6 years, 4 months ago Andre 1 -
0
votes1
answer2444
viewsList installed print server printers from a remote station
I work in a company that has the following structure: Each city of my state has a headquarters with a server that is also print server, in it are the printers of this headquarters. I use the psexec…
-
0
votes1
answer55
viewsLinux Package . TAR Autoinstallable
I am following this procedure to create a file compactado autoexecutável but I’m not succeeding, something is missing? Compact the files to pacote.tar.gz I create file pacote.sh with the following…
-
0
votes0
answers616
viewsPHP - Function exec, shell_exec and system do not work properly
Running the example of documentation on the site works. Examples: echo exec('whoami'); $output = shell_exec('ls -l'); echo "<pre>$output</pre>"; My code does not differ so much from the…
-
0
votes1
answer485
viewsLINUX - how to use a string as a delimiter in the cut command
How do I use a string in the cut? command: cut -d"String" -f1 but he says it is only possible with a single character.
-
0
votes1
answer118
viewsString Return to Array
I’m making a shellscript and have the return command: $ sqlite3 banco.db 'select code from channels' 00 01 02 03 When I assign the return to a variable, everything becomes a single string. $ export…
-
0
votes1
answer176
viewsArtisan Laravel linux script
I hired a shared server, which performs scheduled tasks (CRON TABLE) via linux scripts (.sh). How to run a command php Artisan (php artisan enviar:emaildiario) within that linux script? UOL server:…
-
0
votes2
answers41
viewsI can’t change the value I want from a file through Shellscript
88020:Maria Aguiar:EIB2:914256321:[email protected]:carro:Mercedes:1414-TX-13:13:14:4 83605:Tiago Domingues:ETA4:934442913:[email protected]:carro:BMW:14-TD-16:1:130:200 I have this code in a file, name…
shell-scriptasked 6 years, 2 months ago Tiago Domingues 3 -
0
votes1
answer151
viewsFailed to get about: googleapi: Error 401: Invalid Credentials, authError
I’m using a generic Linux application from Google Drive, which aims to Upload local folders to Google Drive via Shell Script. However, when trying to run command on the Debian terminal: ./gdrive…
-
0
votes1
answer178
viewsForce a shell script to run in the terminal
The user will download the script from an internal website and run it. What I wanted was that after downloading the user take two clicks on the script and it runs and not open for editing. There is…
-
0
votes0
answers252
viewsWrite to a Shell Script file
I have a problem writing a line in a file using Shell Script. I’ve tried using sed and echo, but in both I don’t have the expected behavior. Using the sed: sed -i -e 'export…
-
0
votes2
answers130
viewsHow can I turn " to " in a bash script
I made a small script in Python that transformed a file .py in a Linux bash script, however, the quotes that are inside the Python file end up making the script not work. Is there any way I can turn…
-
0
votes2
answers100
viewsIdentify the amount and value of arguments received in a script
How to identify the amount of arguments I received in a Bash script? How can I get past values?
-
0
votes1
answer262
viewsCommand to open the terminal in a specified folder
I am producing some scripts to prepare the desktop, and wanted to leave the terminal in a predefined folder. How to do this? I’ve tried using cd ./pasta_selecionada and cd pasta_selecionada, but…
-
0
votes1
answer75
viewsExpected operando in for loop shell script
I am creating a function in shell script that says if the number is prime or not, but I am getting a syntax error in for loop that the function has and I could not find how to fix. # ... 9 ehPrimo()…
-
0
votes0
answers54
viewsI need to inform a user and show if this user exists or not using Shell Script with CGI and Apache2
#!/bin/bash echo "content-type: text/html" echo " <html> <head> <meta charset='utf-8' /> <title> Shell Script com CGI </title> </head> <body> <h1>…
shell-scriptasked 5 years, 9 months ago MagShania 353 -
0
votes1
answer61
viewsUse C in Shellscript
In Shell we can use within the script other languages like awk and sed, I wonder if it would be possible to use the C language, and if yes, as.
-
0
votes1
answer95
viewsrun python file list with shell script
My code: #!/bin/bash scriptspy =( '/scs/sp1.py', '/scs/sp2.py', '/scs/sp3.py', '/scs/sp4.py', '/scs/spweb.py', '/scs/sp11.py', '/scs/spservice.py', .... ) for i in scriptspy; do python3.7 $i; done…
-
0
votes1
answer53
viewsjson manipulation via command line
I’m using the jq to manipulate json via command line. Having as input a json obtained via gitlab api: [ { "id": 001, "description": "Uma descrição teste", "ssh_url_to_repo":…
-
0
votes1
answer46
viewsLoop running only for first line shell script
I need to make a script that reads a list of querys of a txt file, and save the result of each query in a file with the table name. My script went like this: #!/bin/bash oIFS="$IFS" IFS=;…
shell-scriptasked 5 years, 8 months ago Wellington Martins 3 -
0
votes0
answers38
viewsWait command with PID
Hello, I am trying to automate a task and am encountering problems with PID. My code: for i in 5 10 do echo "omnetpp.ini Generated! Running." ../../bin/Castalia -c General PIDCAST=$(ps aux |grep…
shell-scriptasked 5 years, 8 months ago ARSaraiva 7 -
0
votes0
answers24
viewsShell - Enter or put program into variable
I have the following code: for (( c=1; c<=10; c++ )) do cc stringalea.c -o st aux = ./st $c echo $aux ... done The stringalea. c program returns a pseudo-random word of length "c". How do I enter…
-
0
votes1
answer44
viewsString set for a for loop using pipe (shell script)
I’m trying to write a shell script that processes some strings and passes them all by pipe to a for loop, but I’m having trouble getting the iterator through those strings, because I thought that…
-
0
votes1
answer64
viewsLinux - incorrect result with find and xargs command
I’m trying to list the files of the last day, but through the command below it lists the files of the last day and then starts to list all the files: [oracle@orcl11 adump]$ find . -ctime -1 | xargs…
-
0
votes1
answer306
viewsHow to display the contents of a div with PHP parameters
I need help updating content within a div that is displayed as a result in PHP. This div contains PHP variables to display the results that are taken from a text file that is in another directory.…
-
0
votes1
answer272
viewsReturn a JSON Array with shell script to use in PHP
Good evening, you guys, I’ve been hitting myself with something for a few days. I am developing an application to connect via SSH in an OLT with shell script and return the "Shows" to a web…
-
0
votes1
answer44
viewsShell Script Backup Error
Guys,I’m trying to make a script in which when plugging the USB stick into the pc, it would synchronize the files from certain folder of the USB stick to the pc. I created a udev rule so that when…
-
0
votes1
answer117
viewsDoubt involving multiple conditions in an IF using Whiptail(TUI) in Shell Script
I am making a simple configuration file in Shell script with a TUI(Text User Interface) using Whiptail, I need to restrict the user input so that the program accepted as input only a range of…
-
0
votes2
answers63
viewsHow to get only a chunk of a command output
How do I show only the version number? Example: GIT_VERSION=$(git --version) echo $'git instalado com sucesso! Na versao: '$GIT_VERSION$'\n' The output I wish is "In version: 1.20.2". I have tried…
-
0
votes2
answers126
viewsFormat file . csv in bash
I have the following problem: I copied the data from an Internet table into a text file. The goal is to turn this file to the default. csv in English (comma separated and decimal separator being the…
-
0
votes1
answer199
viewsProblem with variables that receive content from a shell command
I have a problem in a shell script I’m using for a test for a future task. The script is simple... I have a text file that has 2 columns with the delimiter ";". In the first column there are…
-
0
votes1
answer16
viewsusing Sox to compare duration of an audio file with a variable
good afternoon. I would like the help of the people. I am writing a scrip to separate songs in function from their duration in seconds using the soxi command of the Sox(apt install Sox) package. I…
-
0
votes2
answers388
viewsShell Script Compare multiline variable values with string
Talk people! How do I compare a multiline variable (2 lines) with a string and have to validate one line at a time the contents of the variable is: ambient_1 ambient_2 code test you: #!/bin/bash…
-
0
votes1
answer516
viewsHow to set variable using substring in batch code (Windows CMD)
Talk to you guys, I am trying to generate a code seeking part of the service name in Windows to set in a variable (ORACLE_SID). I need to search the service Oracleservice. Next to the name has the…
-
0
votes2
answers102
viewsrotate a "for" loop with 5 variables together
Use a program to create audio files called stem which combines vocals, drums, melody, bass and an audio guide into a single file. I am trying to create a loop that stores these files and so the…
-
0
votes2
answers141
viewsHow to group substrings in condition and return them with BASH_REMATCH
I need to split a file-named string, in 5 parts, as an example below: #!/usr/bin/env bash str="python-zope-proxy-4.3.5-1-x86_64.chi.zst" pkg_re='(.+)-[^-]+-[0-9]+-([^.]+)\.chi.zst*' [[ $str =~…
-
0
votes0
answers26
viewsI’m having errors with json [shellscript]
I’m trying to learn how to make bots for Telegram, but this mistake keeps appearing false|400|Bad Request: can’t parse reply Keyboard Markup JSON Object caldeirão_furado.sh: erro: linha 24:…