Querying Git status with Subprocess throws Error under Linux

I want to query the status of the git repo using python. I am using: subprocess.check_output("[[ -z $(git status -s) ]] && echo ‘clean’", shell=True).strip() This works fine on MacOS. However, on Ubuntu Linux I get an error message: {CalledProcessError}Command ‘[[ -z $(git status -s) ]] && echo ‘clean” returned non-zero exit status 127. I… Read More Querying Git status with Subprocess throws Error under Linux

How to find possible unquoted pattern after predicate `-exec'?

I have 5 files that I want to unrar(and I have done it many times): find . -name "*.rar" ./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part5_Downloadly.ir.rar ./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part2_Downloadly.ir.rar ./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part4_Downloadly.ir.rar ./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part1_Downloadly.ir.rar ./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part3_Downloadly.ir.rar My command find . -name "*.rar" -exec unrar x -o+ \; Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part1_Downloadly.ir.rar I got error find: paths must precede expression: `Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part1_Downloadly.ir.rar’ find: possible unquoted pattern after predicate `-exec’? Why? >Solution :… Read More How to find possible unquoted pattern after predicate `-exec'?

What is the correct onliner for a column filter expression using Perl?

I try to filter expression from a configuration file under Linux mixing bash command line tools and Perl commands in a pipe. I have a configuration file (see section configuration) and can filter the relevant lines by using ` grep PG.DATABASE database.conf | \ sed -r -e ‘s/^\s*//;s/\s+/ /’ | \ cut -d ‘ ‘… Read More What is the correct onliner for a column filter expression using Perl?

Print all positional arguments in PowerShell

I’m trying to write a PowerShell function that prints out all its arguments. ArgChecker.ps1 function Print-Args { [CmdletBinding()] param ([string[]]$words) Write-Verbose "Count: $($words.Count)" Write-Output "Passed arguments:" $words } I’d also like to call it from a command prompt. I’m doing it like this powershell -ExecutionPolicy Bypass -command "& { . .\ArgChecker.ps1; Print-Args ‘hi’ ‘Two’ -Verbose… Read More Print all positional arguments in PowerShell