Article 5RG3T bash script and reading from file into variable

bash script and reading from file into variable

by
bomberb17
from LinuxQuestions.org on (#5RG3T)
I have the following script named test.sh:

Code:#!/bin/bash

flag=`cat ~/flag`
if [ "$flag" == "$1" ]; then
echo OK
else
echo FAIL
fiThen I run the following:

Code:$ echo 1 > ~/flag
$ ./test.sh
FAILCan someone help me understand why the first condition is not satisfied?latest?d=yIl2AUoC8zA latest?i=tSsmMXbCMmE:ToiN4btEcAw:F7zBnMy latest?i=tSsmMXbCMmE:ToiN4btEcAw:V_sGLiP latest?d=qj6IDK7rITs latest?i=tSsmMXbCMmE:ToiN4btEcAw:gIN9vFwtSsmMXbCMmE
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments