Most voted "shell" questions
This is a program that takes, interprets and executes user commands, appearing on the screen as a command line, represented by a command interpreter, which waits on the screen for user commands. " Shell" is also used to describe applications, including software that is "built around" a specific component, such as browsers and email clients that are themselves "shells" for HTML rendering engines.
Learn more…208 questions
Sort by count of
-
1
votes1
answer461
viewsHow to make condition receive a parameter followed by an argument
I’ve been trying to create a structure if..else with a parameter passing. See: Example $ opt-get -i pacote.tgz Yes, I’m creating something similar to tool apt-get of the Operating System Debian. I…
-
1
votes1
answer75
viewsbash program shows no data output
Good afternoon, I program in C and it’s the first time I’m programming in Bash (shell-script). I did some functions in bash, learned to call and created an interactive menu with the user, my program…
-
1
votes1
answer60
viewsRedirect standard HCIDUMP output using GREP to a file
I am using a shell script to do HCIDUMP and using some filters to write to a file. With the following command, the destination file is empty. hcidump -a l2cap | grep -v -e 'CAP' -e 'HCI' >…
-
1
votes2
answers342
viewsexec does not work - apparently runs the same call file
I have a time consuming script that prevents the execution of other processes while it does not finish. As a solution, I decided to create a file that runs it by the exec command (Mkt-start.php).…
-
1
votes2
answers1785
viewsCall cd command in c++ using system()
I’m trying to "program a shell" inside C++ but I’m not able to use the cd command (path) it just won’t go, searched and saw that when I use the system() a new shell is created outside the directory…
-
1
votes1
answer97
viewsLog Shell cakephp
I have a SHELL file in cakephp as below: <?php class AtualizarIndicadoresNormaisShell extends AppShell { public function atualizar() { //Chama model e sua action…
-
1
votes1
answer133
viewsInstalling web environment with shell script
The shell script below performs some simple tasks for me, however, I would like to leave the code a little but elegant: #!/bin/bash echo "#######################" echo "Preparando servidor web" echo…
-
1
votes1
answer5830
viewsHow to run shell commands on debian startup?
I need you to call my Raspberry pi 3 for it to execute the following scripts: $cd ~/Desktop $source ~/.profile $workon cv $python raspberry.py only that, then it will already run my program…
-
1
votes2
answers841
viewsReplace "[" with [ using sed
I am trying to fix some formatting errors of a file and have as input: "[""teste""]" And I wanted to get an output like: ["teste"] I’ve tried this command but it makes me wrong: sed -i s/"["/[/g…
-
1
votes1
answer147
viewsShow only lines that appear more than x times. (shell script)
I am analyzing a log file and I wanted to filter only lines that appear more than 10 times inside the file. Only I’m not finding a way to make this filter.…
-
1
votes2
answers8165
viewsShell Bash, How to pass given from Shel as parameter
i need to run a file file1.sh, but in addition I need to take the data that comes after it, for example: file 1.sh 171.55.8.45, this ip that comes after, in the same line of the file, before…
-
1
votes1
answer146
viewsFlag at command line bash shell
I’m trying to put a flag that can sort or shuffle output, but I could only do that in code and intended it to work when you put the flag in the command to run the file, for example. /bash.sh -r.…
-
1
votes1
answer94
views -
1
votes0
answers208
viewsDisconnect the headset microphone
I want to force the device to use its own microphone, not the headset I tried using the command "android.intent.action.HEADSET_PLUG" in the shell but I think I’m using it wrong. Can someone help me…
-
1
votes1
answer47
viewsCommand in the Shell
I need to copy the last file created in one directory to another via ssh. I’m using the following command: ssh -oStrictHostKeyChecking=no user@IP "cd /home/user/backup_database/hour/; cp "`ls -1trap…
-
1
votes1
answer181
viewsUnix Command Grep output manipulation if no result is found
Good morning!! I am creating a script and I need that when I do a grep on a line and do not find it it return me the parameter I searched! grep "192.0.0.1 " /file.txt In the.txt file it does not…
-
1
votes2
answers112
viewsHow to find out what is file and what is directory
The question is as simple as the logic I have here. Logic: Assuming that files should always contain their suffix . png . txt etc... While folders/directories carry nothing but their format name The…
-
1
votes1
answer257
viewsRun shell_exec with UTF-8 in PHP
I am developing a system in PHP language and use the command shell_exec, but when I return some message with accentuation, it does not show the character. Example: Commando:…
-
1
votes1
answer28
viewsHow to make a shell file create a php page
I’d like to make a MIB (Management Information Base), which is created, and I have to create the manager and the agent. I am using shell to do this, in the agent I have to create a page in PHP, to…
-
1
votes1
answer356
viewsShell script take out extension and search only by name
Someone can fix my script? The purpose of the script is to compare the input files with the files in the folder JUNK, the problem is that if the input file is teste1.txt he cannot find the file…
-
1
votes1
answer74
viewsRemove content between two files
I have two files. A file contains words like a dictionary and another file, contains logs. I would like the file containing the information (Dictionaries) to be removed from the Log file. Remove the…
-
1
votes1
answer82
viewsHow to create a ZIP file in Shell?
How do I create a ZIP file in Shell with the files of today’s date? The files are all in the same directory.
-
1
votes1
answer203
viewsHow to redirect the entire bash script within the script itself?
I need to throw his output into a file instead of playing on the default output which is the screen but without me having to spell it out with the command >> in the terminal, I want the script…
-
1
votes1
answer174
viewsProblem running a shell script using Zenity. Message: Gtk-Message: Gtkdialog Mapped without a Transient Parent. This is discouraged
When I execute script sh. via shell linux, appears this message: Gtk-Message: Gtkdialog Mapped without a Transient Parent. This is discouraged. How do I resolve this issue? #!/bin/bash get_url () {…
-
1
votes1
answer287
viewsHow to check if a connection is "sleeping" in php?
I have the following script: $fp = @fsockopen($IPAddress, $newport, $errno, $errstr, (float) 0.5); if ($fp) { echo("Conectado\n"); } else { echo("Desconectado\n"); } This script checks if a given…
-
1
votes1
answer43
viewsHow to use t (tabulation) on EOF outputs?
See the example below: cat << EOF alias\tVARIABLE = command EOF Execution output does not take regex into account \t.
-
1
votes1
answer191
viewsShell Script - "split" em for
I made a query that imputes the result in a file .txt in this mold: -----id--------action H000tg6b JOB H000oi8a JOB H00067w JOB I need to make a for to go through that file and use the two pieces of…
-
1
votes1
answer55
viewsHow to format response of a bash command?
My intention is to print on the screen the number of pages of each PDF in a given directory. I even managed to do this through the following command: find "$PWD" -iname "*.pdf" | xargs -i pdfinfo {}…
-
1
votes1
answer168
viewsBash write output in terminal and file
I am creating a script and need the outputs to be shown in the terminal, but also saved in a file #!/bin/bash echo "Olá Mundo" and I am redirecting the output to the file as follows ./teste.sh >…
-
1
votes1
answer1137
viewsRemove character in Shell Script
all right? I’m making a script to read a log on my server to pick up just a few parts that interest me and play in a . csv. The script is very simple, follow: #!/bin/bash export…
-
1
votes2
answers323
viewsPython-based web Scrapping does not provide complete html page information
Personal greetings, I’m trying to use python to get the information from the page http://www.nfce.se.gov.br/portal/painelMonitor.jsp , is a page from Faz where it has the ping status of NFC-e…
-
1
votes1
answer32
viewsVariable running on its own
I am trying to create a variable that I will only use when I want to create a folder. But this same variable is creating this folder before the IF condition and the READ condition are executed.…
-
1
votes1
answer43
viewsProblem with case in script
Someone explains me why my script is only returning the "Error option"? #!/bin/bash #==========================# DATA=$(date +%T) #Vai mostrar a hora com os mins CORTE=$(date +%k) #Vai mostrar…
-
1
votes1
answer72
viewsPowershell, shell_exec + Get-Printer
I’m trying to get a result from server B through server A, by Powershell in php. Basically I’m giving the command PowerShell Get-Printer -ComputerName (Servidor-B) -Name (Impressora) | Format-List…
-
1
votes0
answers50
viewsIs it possible that a script knows where it was called?
I have a script.sh and I wonder if there’s any way he could know where he was called. ex: comando=$(existe algum comando pra isso?) variavel=$AlgumaVariavelDeAmbienteTalvez if [[ $comando == "x" ]];…
-
1
votes1
answer372
viewsHow to assign a variable the sed command with formatting? Shellscript
I’m having a problem making a program to exchange the first number for X, because even if it works, the variable does not receive the value permanently: VAR="oi 200 20 10" VAR= echo "$VAR" | sed -r…
-
1
votes0
answers153
viewsDirect Print PDF C#
Hi, I need some solution to print directly to the printer a pdf, without opening dialog boxes and without using adobe, the pdf was generated with the pdfsharp library, I can even use libraries but…
-
1
votes1
answer44
viewsError in logic to replace all phrases within an x file using Bash Shell Script
How can I replace all the same phrases within a file, using Bash Shell Script, when receiving the value to be replaced from a variable? 1 - How I would like - but it doesn’t work.:…
-
1
votes1
answer94
viewsLoop through the lines of a file and print parts of it in sequence
I have a text file that has several lines separated by two points. See for example: teste1:testee1 teste2:testee2 teste:testeeee Using a loop for, I’m trying to get the script to print on the screen…
-
1
votes4
answers120
viewsHow to filter an HTML tag and its contents with regular expressions in Shell Bash?
Based on the text below, how to keep the text output from the first column of tag span, that matches the text of the latter span? <span class="CVA68e qXLe6d">Colcha Casal e ... -…
-
0
votes2
answers470
viewsSimulate receiving device connection on usb (adb shell Android)
I would like to know how to simulate receiving a call (Receive a call) with the device connected via usb on adb shell android. I need to perform some tests on the physical apparatus, but cannot be…
-
0
votes2
answers199
viewsHow to check if a provider is on . ssh/known_hosts?
I have a script that synchronizes git repositories. If the repository has never been synchronized, directories are created. Eventually, when a repository is added, the server serving the repository…
-
0
votes1
answer129
viewsRedirect output to variable with whitespace
I am making a script where I want to capture a path to the name of a user file and then use it, plus the extension, to redirect the output of a command. example: Insert path: ~/Videos/file I do it…
-
0
votes1
answer325
viewsCount number of occurrences in a for in loop {Bash}
I have the following script #!/bin/bash for file in *.jpg; do convert $file -resize 1920x1080! -blur 0x8 alterado$file; echo "A Processar o ficheiro $file" done I want to do an echo with Processor…
-
0
votes3
answers280
viewsMake a shell script bash that extracts to a new file all names and nr of women whose number starts with "91"
Consider that there is a "file1.txt" file that you have for example: Name of the person;Sex;Postal code;Cell phone number;Brand of the Cell Phone ... How do I write a shell script bash that extracts…
-
0
votes2
answers768
viewsWhat does -Rf mean after rm?
I have a command in SSH on the platform Magento (installed on a server Apache) to delete the contents of the cache folder rm -rf path/to/folder/* but I’m not really sure what -rf means.…
-
0
votes2
answers453
viewsHow to compact directory except a specific folder via SSH with zip command?
I have to compress all the files and directories of the directory public_html except for var which has more than 60GB. How can I perform this operation via SSH commanding zip? I saw some shapes with…
-
0
votes1
answer354
viewsUse cmd commands in shell scripts - cakephp 3.0
I was wondering if you can use native windows CMD commands from scripts made to run in the cakephp shell. I already run tasks that run in cmd, but with the commands of the framework itself but would…
-
0
votes1
answer35
viewsrequest for support in optimization, fix shell command for mac
I am looking for the best way to optimize the following command shell in the Mac OSX, in order to fulfill the function that is intended which is basically to copy all files xx to the folder xx2:…
-
0
votes2
answers680
viewsCommand adb open youtube URL via Browser
To start a URL via adb, I have the following command adb shell: adb shell am start -a android.intent.action.VIEW -d 'https://youtu.be/CSULRDoF8-g' That works. But in the case of a Youtube video URL,…