I tried below but it doesn’t work. Throwing some errors. Exp1 or expr2 should evaluate first & at result should be evaluated with expr3 ( &&) i tried as per suggestion, it throws error as Fyi- that date is val1 value. Answer You might see different results based on the shell or version, eg: sh vs bash vs ash. One
Tag: unix
How to give permission to root user generated file by other user in linux?
I am trying to giving permission to root user generated file but not able to do this. Can anyone help me how to do this? I tried: Example: Expected result: Answer First of all, I can’t see what you’re doing by “echo -e ‘password'”. The ‘>’ character means “output redirection”, that is, bash will redirect the input of the “echo
Unix -Delete even bytes from a file
I want to find and delete all even bytes from a file given in command line. Is there any command for this situation? Answer I think this does what you want. It dumps the file as continuous plain hex, then reads two bytes, saving them for later and then two more bytes. Then it outputs the bytes it saved and
Declaring variables with indirect reference with a prefix
I have my parameters stored in a file and calling them with a prefix which i get it has input. now, i am getting the input and prefixing it and storing as a new variable and then pointing my new variable indirectly to my actual variable to use in my script. Is there a way to directly mention the indirect
Is it possible to display a file’s contents and delete that file in the same command?
I’m trying to display the output of an AWS lambda that is being captured in a temporary text file, and I want to remove that file as I display its contents. Right now I’m doing: Is there a clever way to combine those last two commands into one command? My goal is to make the full combined command string as
Segmentation fault error as the reader tries to read from the shared memory
I am trying to understand the System V shared memory APIs. I created a small program where one writes into the shared memory and another reads from the shared memory. But for some reason, I am getting an error : as I try to read from the shared memory. I could not find the reason for it. Here is what
Unable to use SED command [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question i want to call a shell scripts which has sed command in it to format the xyz.csv generated by this shell. SED gets unrecognised in
How to get unix style prompt in windows (batch)
I am trying to make dos shell which displayes a unix/linux promt. The code is: I want it to display directory name like in unix/linux but it displays a ~. What is wrong in my code? Can you please help me improve it? Answer Probably not quite on the ball with the prompts specific situational substring modification, but the Method
unix command to search count of 5XX status HTTP requests in the log
i need to write a unix command to search count of 5XX status HTTP requests in the log. Log format is like below example : any suggestions ? Answer A minimal solution would be grep will filter the output to only the lines including the string 5XX, where X is any digit character. This output is then piped to wc
Copy a folder contents and save the file with diff name Unix
I have a bunch of .txt files in a directory. I m looking for a command to copy all .txt files and save it with <filename>_2.txt. Eg: abc.txt -> abc_2.txt (After copy) Thanks in tons in advance Answer EDIT: As per OP’s extension request adding following code now. Try following. Above will print cp commands, if you are ok with