samona Posted December 28, 2008 Share Posted December 28, 2008 Hi, I was wondering if someone could explain what the following code means. if test "x$output" = "x" Also, why would you put "x$output" why not just "$output" ? Link to comment https://forums.phpfreaks.com/topic/138605-shell-programmin/ Share on other sites More sharing options...
corbin Posted December 28, 2008 Share Posted December 28, 2008 The only thing that I can think of is that it's checking if $output is empty.... Maybe someone that actually knows what's going on can help more though ;p. Link to comment https://forums.phpfreaks.com/topic/138605-shell-programmin/#findComment-724762 Share on other sites More sharing options...
samona Posted December 28, 2008 Author Share Posted December 28, 2008 Yeah, i think you're right. So if $output is empty then x$output would equal x. But why not just say if $output="" or maybe that's not possible in shell programming? Link to comment https://forums.phpfreaks.com/topic/138605-shell-programmin/#findComment-724777 Share on other sites More sharing options...
trq Posted December 28, 2008 Share Posted December 28, 2008 The only thing that I can think of is that it's checking if $output is empty.... It is indeed, in a very roundabout way. There a better methods built into bash. if [ -z $output ] ; then echo '$output is empty' fi Link to comment https://forums.phpfreaks.com/topic/138605-shell-programmin/#findComment-724798 Share on other sites More sharing options...
corbin Posted December 28, 2008 Share Posted December 28, 2008 Weird.... Link to comment https://forums.phpfreaks.com/topic/138605-shell-programmin/#findComment-724959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.