Most voted "sh" questions
9 questions
Sort by count of
-
4
votes2
answers166
viewsWhat does the double-dash stand for in a Bash command?
There is a little time that I use Linux and I know that some commands have arguments that use the - at the beginning of a word. Example: ls -la And some others use two traits, so: php artisan --help…
-
2
votes3
answers861
viewsHow to recursively rename numbered files by naming other files
What I am currently looking to do is rename all files in a folder, where there are also other files of different format. See Example: FOLDER - BEFORE 1.txt 2.txt 3.txt Daniela.jpg Amanda.jpg…
-
2
votes4
answers117
viewsCopy one line at a time from the source file to the target files
A new need arose accompanied by a good and new question that until then did not find anything similar on the internet - Copy a single line at a time to a different single file. Example for each new…
-
2
votes1
answer79
viewsHow do I pass an array as an argument in PHP and receive all the data in the shell?
Example: <?php $param=array(valor, valor2, valor3); $return = shell_exec("sh teste.sh $param"); echo "<pre>$return</pre>"; ?> Shell script: #!/bin/bash param=$1 echo $param That…
-
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
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.:…
-
0
votes1
answer240
viewsRun sh in java
I am trying to run a file in java with the following command System.out.println("Linux"); String[] env = {"PATH=/bin:/usr/bin/"}; String cmd = System.getProperty( "user.dir" ) +…
-
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
votes1
answer24
views