Skip to content
Advertisement

Tag: shell

how to set variable name for google cloud instance

PROB_INSTANCE_NAME=INSTANCE_NAME not working C:UsersHPAppDataLocalGoogleCloud SDK>PROB_INSTANCE_NAME=lamp-1-vm ‘PROB_INSTANCE_NAME’ is not recognized as an internal or external command, operable program or batch file. C:UsersHPAppDataLocalGoogleCloud SDK>set PROB_INSTANCE_NAME=lamp-1-vm C:UsersHPAppDataLocalGoogleCloud SDK>gcloud compute instances stop “$PROB_INSTANCE_NAME” ERROR: (gcloud.compute.instances.stop) HTTPError 400: Invalid value ‘$PROB_INSTANCE_NAME’. Values must match the following regular expression: ‘a-z?’ i am using google gcloud tool on the desktop. trying to install Linux guest environment by

Convert column to matrix format using awk

I have a gridded data file in column format as: I would like to convert it to matrix format as: Where top 20.5 21.5 22.5 indicate y and side values indicate x and the inside values indicate the corresponding grid values. I found a similar question here Convert a 3 column file to matrix format but the script is not

Multi Hop, Self Closing, Background SSH Tunnel

I’m trying to create a multi hop ssh tunnel, that is in the background, and self closing. What I have is… This successfully creates a multi hop ssh tunnel that closes the port on host1 after I close the tunnel. However, if I try to fork it to the background, like this… It runs in the background, but killing the

Access the word in the file with grep

I have a conf file and I use grep to access the data in this file but not a very useful method for me. How can I just get the main word by search-term? I using: Print: I want: (without “export: “) How can I do that? Answer If you’re using GNU grep you can use PCRE and a lookbehind:

Split string in ksh

I got a string as follow : What would be the best way to convert it in seconds without using date ? I tried something like this that sounded pretty nice but no luck : Any idea is welcome, I just can’t use date -d to make conversion as it is not present on the system I am working on.

How to access python return value from bash script

I’m trying to understand how to access from a bash script the return value of a python script. Clarifying through an example: foo.py start.sh If I run the bash script, this prints the message “exec main..”. How can I store in script_output the return value (execution ok)? If I direct execution ok to stdout, the script_output will capture all the

$SHLVL does not increase in ( echo $SHLVL)

I am learning shell scripts and stuck at this little experimental shell scripts: Without doubt, $A in line 3 and line 4 are different from each other, which can be explained that it is because the parent process cannot read variables created in the child process, that is, the subshell. However, the $SHLVL in line 3 and line 4 are

Advertisement