Reputation: 53
In diff command am getting following error. Kindly assist how can I specify I want to see difference in two files:
#current_unavail=ranjith
root@iitmserver1 tmp]# cat /tmp/ran
ranjith
[root@iitmserver1 tmp]#
#test=$(cat /tmp/ran)
[root@iitmserver1 tmp]# diff `$current_unavail` `$test`
diff: missing operand after `diff'
diff: Try `diff --help' for more information.
[root@iitmserver1 tmp]#
Upvotes: 1
Views: 10964
Reputation: 32232
diff
takes two filenames as arguments, where you appear to be passing in file contents as the first argument. You will want to change your script/commands to look more like:
current_unavail=/tmp/unavail_cn.out
result=$(diff $current_unavail /moes/home/pharthiphan/scripts/monitoring/unavail_cn/$last_unavail)
Alternatively, you can use Process Substitution to pass the output of a command into another command that is expecting a file. eg:
diff <(echo -e "foo\nbar") <(echo -e "foo\nbaz")
However, while good to know about, this would seem to be a needless level of complexity for your current problem.
Upvotes: 2