Skip to content

Tag: shell

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 …

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 r…

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 fir…