Skip to content
Advertisement

Tag: shell

Why I get an error when I try to execute a command remotely?

I have a problem about execute command remotely via SSH. I am trying below. It gives an error like: Answer The problem is that you’re using double quotes to delimit the argument to ssh and also the argument to psql inside the command. This is causing your strings to be parsed incorrectly. You’re also missing the ending double quote for

Script terminates when storing grep -c output when value is 0

I am trying to check if a file has CR line feed and store the result 0 or 1 into a variable. Here is my command that runs inside a script. The script runs until the previous line and doesn’t run this line but terminates abruptly. Inside an echo statement it works perfectly. This prints isCR=0 or isCR=1 depending on

How to access specific path in linux using shellscript

Let us consider an example, scriptPath=/home/sharath/Downloads/Atollic_TrueSTUDIO_for_STM32_9.2.0_installer In the above line of code, If user is “sharath” then he can access a file/folder same way if the user is different how can access that folder/file dynamically. below is my shellscript(.sh file): In last line of the script, ${scriptPath} is diffrent for diffrent user, how can handle in shell script. Update 1:

bash script unable to ask confirmation

I am initiating myself to shell scripting and I need to ask the user about confirmation. I have this script, which I don’t know why the following command is not working: read -p “Are you sure about this action?” yn I use it twice, at the beggining of the script and in the middle. The first read works, but the

need help on shell script for expected output

I have an input file called input.txt like this: I extract the text up to just before the fist capital letter in the first field and store those snippets in output.txt: I used the sed command to separate out the values and it’s working fine. From the output file (output.txt), I need to grep from the first field, and output

Decode base64 strings into hex strings in a file and overwrite

I have a list of base64 strings in a file (file.txt) that I need to convert into hex. E.g., Command: This command works individually (albeit the spaces in between), but I need to convert through each string in the file, which has more than 500 lines. Basically, I want the above base64 string format to be decoded to the below

Advertisement