so I’m working on a simulated linux shell using C (homework), and I have it exiting the program if the user just simply types in “quit”. However, if they throw “exit” somewhere inside a command… “cat file ; exit” I need it to execute the command like normal, then quit. I know that I still have to filter the string
Tag: shell
[: missing `]’ error in Unix | shell Script [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 3 years ago. Improve this question
similarity between the two files using grep, why this work: grep -i “-ffile1” file2
I have two files, file1 and file2, and want to find the similarity between the two files using grep. why -f should flow by the file name without spaces when I surround the -f file1 with quotes? this will work but this will not work but if I remove the quotes these two cases will work Answer By convention, one-letter
Use awk command to get information below a pattern
I have a file with a wide range of information and I want to extract some data from here. I only will post here the interesting part. I want to extract IQ and JQ values as well as the J_ij[meV] value which is two lines above. I read this question How to print 5 consecutive lines after a pattern in
How to make an autoinstall command script for Debian
So I was working on a project that need some libraries . so I decided to made an .sh script to just install all at once but I don’t know why it fails . I was searching about it , but just found how to create installer like .deb , etc here are the commands lines that I use install.sh
use cat <> to insert actual strings and escape logic
I am writing a script to automatically create SWAP on an AWS ephemeral volume. Part of that process requires the script to ‘sense’ which nvme to apply swap to since AWS Linux can reorder the nvme names at stop/start. I am using Terraform to run a ‘start-up’ script which does a ton of stuff to the instance. One of them
can not decrypt a message using openssl CLI, which was encrypted using openssl API
I was using the above code from Linux libcrypto AES-128 CBC Encryption/Decryption works on Ubuntu but not Raspberry Pi Modified the code slightly here If you run the code, you can see the below output. OpenSSL 1.1.1 11 Sep 2018 Original : 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F Encrypted :
Is it possible to get command arguments now executing?
I want to declare aliases which append argument if no argument specified. For example, I expected executing vimtutor with no argument is replaced to vimtutor ja.utf-8, but it doesn’t work properly. So, I tried some tests on bash shell. And I understood it is impossible to get command arguments now executing in normal way. Now, I declare shell function showing
Remove column matching 2 patterns with AWK
Multiple lists of Books with ISBN,TITLE,OBSERVATION and other with OBSERVATION,TITLE,ISBN, I want remove column OBSERVATION, print TITLE as 1st column and ISBN as 2nd as follow. Input: 123654 Cosmology Updated 35647 Medecine Revised 987456 Juriprudence Revised Updated Rhetorics 123456 Revised epistomolgy 654321 Ouput desired: Cosmolgy 123654 Medecine 35647 Rhetorics 123456 epistomolgy 654321 I tried this code found in SE and
remove character on the last line that specific word appears
we have the following file example we want to remove the , character on the last line that topic word exists expected output we try to removed the character , from the the last line that contain topic word as the following sed cli but this syntax not renewed the , sed (GNU sed) 4.2.2 Answer In case you have