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]#
$current_unavailwould appear to have spaces in the filename (or isn't the name you expect it to be).$current_unavailis the contents of the current file? That's not going to work. Also it seems it does have a space there (update the post instead of putting things in comments so you can format them). Which is why you need to quote your variable but that isn't enough here because diff takes files as arguments.$last_unavailis a filename. You pass that file todiff.$current_unavailis a string (of two "words"). You also pass that to diff (unquoted). The fact that$current_unavailis unquoted and more than one word is why you get theextra operandserror.diffis seeing three argumentsiitmc07n24-ib0,unavail, and the$last_unavailfile. That's the first problem. Quote"$current_unavail"and that will go away. The second problem, however, is that you are trying to pass the files contents to diff directly but diff takes filenames. Use/tmp/unavail_cn.out.