Category "shell"

Replace tags in text file using key-value pairs from JSON file

I am trying to write a shell script that can read a json string, decode it to an array and foreach through the array and use the key/value for replacing strings

Automate mysql_secure_installation with echo command via a shell script

I am trying to automate mysql_secure_installation script with automated response. My code is as follows : echo "& y y abc abc y y y y" | ./usr/bin/mysql_se

^U does not kill despite stty claims

problem: ctrl+U will not kill my terminal program. details: Here are my results from ssty --all: speed 38400 baud; rows 24; columns 80; line = 0; intr =

How to create folder and cd into it with one command

I forget a command,could someone tell me? for example, $ makdir project-one-business-dev-2 $ cd project-one-business-dev-2 I don't want to type project's na

Checking if the string is in proper format in Shell Scripting

I am trying to check if the string is in format in shell script. below is the code i am trying and the output i want to get. Format: <datatype>(length,len

Remove percentage printf and shell

I'm beginning to learn the shell commands. And I don't know how to remove the percent character in the end. Example: printf poo shows poo% I'm on mac and I us

"source" command on mac

I have a .bashrc file on Mac OS in which I set some aliases. After I make it and I type source .bashrc, the aliases work perfectly. However if open another shel

Increment variable value by 1 (shell programming)

I can't seem to be able to increase the variable value by 1. I have looked at tutorialspoint's Unix / Linux Shell Programming tutorial but it only shows how to

replace special character [ and ] including . using sed

I would like to replace the [sample]. with space in all my document.Could someone let me know how can I do this.I tried the below command but it doesn't work.th

Fish shell - advanced control flow

Normally, fish shell processes commands like this: 1 && 3 (2) This is perfectly useful and it mirrors the order of execution that I would want most of

Shell script not running via crontab, but runs fine manually

I have a script that checks if the PPTP VPN is running, and if not it reconnects the PPTP VPN. When I run the script manually it executes fine, but when I make

Docker compose create kafka topics

Problem: Cannot create topics from docker-compose. I need to create kafka topics before I run a system under test. Planning to use it as a part of the pipeline,

How to run functions and local resources over SSH in a shell script

I have a shell script file like this: #!/bin/bash CONF_FILE="/tmp/settings.conf" #settings.conf contains OS_NAME="Caine Linux" source $CONF_FILE display_os_n

What is the difference between p and P in sed?

Can anyone explain what is the difference between p and P in Sed? Suppose I want to print lines containing gmail in the below file using both p and P give the

python script to open tera term application and sending keys

I am trying to use Python script to run Tera Term application to open console for Serial port communication and i am sending some commands/keys like {Enter}

How to read a specific value in PLIST file in terminal

I'm trying to access a specific property in a plist file on my MAC OS, but the name of that property has a space in it and I cannot access it. here is the reque

Gitlab Shell Script Permission Denied

I am running a simple shell script with Gitlab CICD and I am getting Permission denied. Kindly suggest When I do chmod +x test.sh it says operation not permitte

Linux Command , how to find files by size larger than x?

I'm trying to find files with size larger than "x" , ex: 32 bytes But what I found in ls --help was only ls -S , that just sort by size and not satisfied my d

What are the differences between a login shell and interactive shell?

What is a login shell and interactive shell, and what is a .bash_profile and .bashrc?

How to check if a user disconnected, if it's a new disconnection and the server on which the action was made?

I have to create a shell program, such that each time certain users (given as parameters) connect/disconnect from the system, it will save in a text file if its