[Solved] why command mv remove all the file? [closed]

Command mv moves files. When file in destination exists, it will be replaced. The right command to copy file is cp. It’s used same way as mv. Command mv git.sh /root/* will substitute wildcard char * with all names the directory contains. Then there are a few cases: /root contains multiple files or directories: command … Read more

[Solved] Execute python script while open terminal

The fish-shell was new to me, so I read the documentation – something I really recommend. Look for the title “Initialisation Files“: http://fishshell.com/docs/current/index.html#initialization So it looked like you call your python scripts from ~/.config/fish/config.fish So I installed fish on my Macbook and I had to create the config.fish file. In that I just placed: ~/gash.py … Read more

[Solved] Installation of package.json

This is the same type of issue as #17. It’s not related to Minishlink/web-push. One of your dependancies is stuck in the past with paragonie/random_compat v1.1.5. You should check which one and ask the owner to update the composer.json. To fix this temporarily, in your composer.json, on your dev machine put: “paragonie/random_compat”: “dev-master as 1.1.5”, … Read more

[Solved] Shell Script – Adding memory functionality

You should store the result in a variable like this: result=$((operand1+operand2)) Then your first if statement can check if this variable has a value, and if it does, skip the read and use it instead. if [[ $result == “” ]]; then echo Enter operand1 value: read operand1 else operand1=$result echo “Operand 1 is: $result” … Read more

[Solved] Python and shell script [closed]

Working with Excel files is definitely something people care about. I love the following author who wrote a book on how to use Python in everyday life: https://automatetheboringstuff.com/chapter12/ This chapter in particular deals with Python and Excel. He describes how to use the package openpyxl. You should be able to read and edit the Excel … Read more

[Solved] When can I run a shell script with command “. shellscript” in bash,ubuntu?

The Bash shell searches the directories listed in the PATH variable in both shellscript and . shellscript cases. The main difference is that when using . (or equivalently source) to start a script, a new shell process is not created for interpreting the script. This is sometimes useful because it allows the script to define … Read more

[Solved] Replacing string with variable with Groovy and SED command

In Groovy variable/expression substitution inside of strings (interpolation) only works with certain types of string literal syntax. Single quote syntax (‘content’) is not one of them. However, if you replace the outer single quotes with double quotes (“content”) then you should get the interpolation effect you are looking for: def sDescription = “foo” def sedCommand … Read more

[Solved] How to fix Python restarting whenever I start program on IDLE environment?

When I run your program I get this output: Python 3.2.5 (default, May 15 2013, 23:06:03) [MSC v.1500 32 bit (Intel)] on win32 Type “copyright”, “credits” or “license()” for more information. >>> ================================ RESTART ================================ >>> You haven’t guessed the right amount of times or u won. >>> This is perfectly fine and expected. I … Read more

[Solved] Search for specific characters in specific positions of line

To search for “foo” at position 42: egrep ‘^.{42}foo’ You can run a command like this multiple times on your input: egrep ‘^.{42}foo’ inputfile.txt > lineswithfoo.txt egrep ‘^.{42}bar’ inputfile.txt > lineswithbar.txt … or as a loop: for pattern in foo bar qux; do egrep “^.{42}$pattern” inputfile.txt > lineswith$pattern.txt done solved Search for specific characters in … Read more

[Solved] awk : parse and write to another file

Use GNU awk for multi-char RS: $ awk -v RS='</record>\n’ ‘{ORS=RT} /<keyword>SEARCH<\/keyword>/’ file <record category=”xyz”> <person ssn=”” e-i=”E”> <title xsi:nil=”true”/> <position xsi:nil=”true”/> <names> <first_name/> <last_name></last_name> <aliases> <alias>CDP</alias> </aliases> <keywords> <keyword xsi:nil=”true”/> <keyword>SEARCH</keyword> </keywords> <external_sources> <uri>http://www.google.com</uri> <detail>SEARCH is present in abc for xyz reason</detail> </external_sources> </details> </record> If you need to search for any of multiple … Read more

[Solved] Practice Linux Shell Scripting

Consider adding a counter, bump it up on every line, and print the counter with every line. Also note fixes to set log_file, update to read command. log_file=”/home/user/log.txt” line_no=0 while read -r line do line_no=$((line_no+1)) printf “%d. %s\n” $line_no “$line” done < “$log_file” One alternative to consider is to call the nl utility, which performs … Read more