Like I mentioned:
Quote:
Originally Posted by rushikeshgaradade
DFS_NAME_DIR="/grid/hadoop/hdfs/namenode /grid1/hadoop/hdfs/namenode"
|
Here a new shell is started to run the command. The variable "DFS_NAME_DIR" becomes defined in this shell's environment. When the script ends, the shell exits and the environment is gone. You can see that by adding "printenv | grep DFS_NAME_DIR" to the end of the script.
Then give that same command on the terminal after the script is done.
If you want that variable to be seen in your command-shell, you have to "source" the script
("." is shorthand for "source").
Code:
source my_script.sh
. my_script.sh
Quote:
i have executed it with
#bash dierctories.sh
but i didnt find any affect of it
|
If you had the variable defined in this shell's environment, the shell executing your
script "directories.sh" doesn't have that variable in its environment unless the variable is exported.
Code:
export DFS_NAME_DIR="/grid/hadoop/hdfs/namenode /grid1/hadoop/hdfs/namenode"
Exported variables are "forwarded" to "sub-shells".
Quote:
and also it is said
mkdir -p $DFS_NAME_DIR
but this command showing error:
mkdir: missing operand
Try `mkdir --help' for more information.
Does this mean that directories.sh file is not executed. or is there any other alternative for "DFS_NAME_DIR"
Please help me.........
|
That's why there is no variable "DFS_NAME_DIR" in your shell environment and the command:
"mkdir -p $DFS_NAME_DIR" becomes "mkdir -p"