Ask Your Question
0

Variable assignment question

asked 2015-08-02 09:19:52 -0500

kartikv gravatar image

updated 2015-08-02 13:36:56 -0500

ramindk gravatar image

This does not seem to work, is it by design?

case $operatingsystemmajrelease  {
  '6': { $TOUCH = "/bin/touch"}
  '7': { $TOUCH = "/usr/bin/touch"}
}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-08-03 07:32:35 -0500

johnnyb04 gravatar image

Try doing this:

case $operatingsystemmajrelease {
"6": { $TOUCH='/bin/touch' }
"7": { $TOUCH='/usr/bin/touch' }
default: { fail('Operatingsystemmajrelease case default triggered.')}
}

Using the default fail statement will at least help you debug if your case statement isn't working or if your variables aren't being assigned correctly.

edit flag offensive delete link more

Comments

That did not work either. It does not go to the default.

kartikv gravatar imagekartikv ( 2015-08-04 17:27:04 -0500 )edit

Are you sure $operatingsystemmajrelease is a variable in facter? What if you used $lsbmajdistrelease?

johnnyb04 gravatar imagejohnnyb04 ( 2015-08-06 10:46:14 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-08-02 09:19:52 -0500

Seen: 416 times

Last updated: Aug 03 '15