Answer by KamilCuk for Expand variable before tilde
I would go with checking if "$omar" is a valid user with id and then using eval to force double expansion. So protect against evil eval and then do it.if ! id "$omar">/dev/null 2>&1; echo...
View ArticleAnswer by glenn jackman for Expand variable before tilde
bash expands the tilde before the variable. See https://www.gnu.org/software/bash/manual/bash.html#Shell-ExpansionsThe shell will see if the literal characters $omar are a login name. As they are not,...
View ArticleExpand variable before tilde
I'm sure this has been asked before but I can't find anything. We have inscrutable login names on a shared machine and want to use shell variables to substitute the hard-to-remember login names for...
View Article
More Pages to Explore .....