Category "shell"

How here document works in shell

While doing the input redirection, the shell opens the file on the right side of '<' with file descriptor 0, but in the case of the heredoc there is no such

How to combine multiple commands output in the one varialble in shell script?

I'm using the following script to get the data of one of the variables from the database file #!/bin/bash sqlite3 pdu.db <<'END_SQL' .timeout 2000 SELECT

BASH : control exits CASE logic after entering any condition - Unable to understand the reason

I have an input file, which has below data : driver2:y driver5:y driver3:n driver1:y driver4:y The requirement is, for each driver if the value is "y" then the

Overcome Windows 7 shell MAX_PATH limit

If context menu key that launches some executable exists in Windows registry and the "%1" command line patrameter place holder is mentioned, the path this execu

Reading arguments from a text file using <

I have a txt file called test.txt that looks like this, hi this is a test and I have a c++ file called selection_sort.cpp that looks like this, #include <io

How to make a pipe conditional within the same line

textfolding="ON" echo "some text blah balh test foo" if [[ "$textfolding" == "ON" ]]; then | fold -s -w "$fold_width" | sed -e "s|^|\t|g"; fi The above code w

How to create and assign a variable name with special character in bash

Sorry if this question is repeated. how can I create a variable a.b and assign a value to it. ---------- root@IN2268980W3:# a=1 root@IN2268980W3:# a.b=1 a.b=1:

Modify xml shared_prefs file using adb

I am trying to interact with android app shared_prefs using adb. Let's use VLC for this example. The shared preferences are stored in: /data/data/org.videolan.v

Check log file for error only for last 10 mins

I've a log file with below text, [2022-05-05T22:25:58,523] Text/debug data I want to fetch log data for errors in only last 10 mins to configure in cron. How t

bash oneliner search for files and dump name and content into new file

as title says I need to write a bash oneliner that finds all txt files and, for each, writes name and content into another file. So far I wrote: find . -name "*

Reading command output with Paramiko invoke_shell/send/recv never finishes

I am trying to use send/recv function in Paramiko. According to what I see, the line throws an exception of timeout Evaluating: self.shell.recv(1024) did not f

syntax error near unexpected token in jupyter terminal

I write a r script below and want to run it in jupyter terminal. But it shows error: ./Rda_to_csv.r: line 1: syntax error near unexpected token `(' ./Rda_to_csv

how to run powershell command from nushell

After installing nushell (https://www.nushell.sh/) in my windows environment, I want to use the power of nushell in conjunction with powershell. For example, I

On Windows why does "poetry shell" remove/lose shell history features?

In the Windows default command shell (cmd.exe) you can access the history of typed commands using various controls (up arrow for most recent command etc). When

shell-command never returns in emacs lisp

I am trying to write a function to send the clipped image in windows host to my Ubuntu WSL2 (defun win2wsl-clipped-image() "use powershell to save the

How to convert ouput into uppercases in kali linux shell

I need to convert from 'ifconfig' command output to Uppercases: I've tried like this: ifconfig | tr [:upper:]

How can I truncate a line of text longer than a given length?

How would you go about removing everything after x number of characters? For example, cut everything after 15 characters and add ... to it. This is an example s

How to add a PWD in to .env

Is there anyway to use pwd or $PWD in .env. Im looking to get the PWD so that I can add it to an PYTHONPATH env. Thanks,

Bash IF condition with multiple conditions not giving proper result

Trying to fetch the status of the URL for sonarqube quality gate and check if the status is "OK" the condition should pass or if the status is "ERROR" then it s

Bash loop trough all users to delete password hints

I have newly started with bash and now I am facing the following problem: lukas@Lukass-MacBook-Pro Desktop % ./script.sh delete: Invalid Path <dscl_cmd> D