Skip to main content
added 23 characters in body
Source Link
jlliagre
  • 62.5k
  • 11
  • 123
  • 162

The issue is more for sudo cd to fail on your OS than sudo echo to succeed.

sudo cd /directory is quite a legitimate method to check if a given user, likely root here, is allowed to cd to some directory. That is the reason why all Posix compliant OSes do provide an executable version of cd.

So the answer to you question is sudo echo yo works by design because echo is provided by both a shell alias and an executable command but sudo cd /directory does not because your OS, likely Gnu/Linux based, is breaking the Posix standard in this specific case.

A simple workaround for your system would be to run sudo sh -c "cd /directory"

The issue is more for sudo cd to fail on your OS than sudo echo to succeed.

sudo cd /directory is quite a legitimate method to check if a given user, likely root here, is allowed to cd to some directory. That is the reason why all Posix compliant OSes do provide an executable version of cd.

So the answer to you question is sudo echo yo works by design because echo is provided by both a shell alias and an executable command but sudo cd /directory does not because Gnu/Linux is breaking the Posix standard in this specific case.

A simple workaround for your system would be to run sudo sh -c "cd /directory"

The issue is more for sudo cd to fail on your OS than sudo echo to succeed.

sudo cd /directory is quite a legitimate method to check if a given user, likely root here, is allowed to cd to some directory. That is the reason why all Posix compliant OSes do provide an executable version of cd.

So the answer to you question is sudo echo yo works by design because echo is provided by both a shell alias and an executable command but sudo cd /directory does not because your OS, likely Gnu/Linux based, is breaking the Posix standard in this specific case.

A simple workaround for your system would be to run sudo sh -c "cd /directory"

added 113 characters in body
Source Link
jlliagre
  • 62.5k
  • 11
  • 123
  • 162

The issue is more for susudo cd to fail on your OS than susudo echo to succeed.

susudo cd /directory is quite a legitimate method to check if a given user, likely root here, is allowed to cdcd to some directory. That is the reason why all Posix compliant OSes do provide an executable version of 'cd'cd.

So the answer to you question is sudo 'echoecho yo'yo works by design because echo is provided by both a shell alias and an executable command but sudo 'cdcd /directory'directory doesn'tdoes not because Gnu/Linux does not follow the Posix standard hereis breaking the Posix standard in this specific case.

A simple workaround for your system would be to run sudo sh -c "cd /directory"

The issue is more for su cd to fail on your OS than su echo to succeed.

su cd /directory is quite a legitimate method to check if a given user is allowed to cd to some directory. That is the reason why all Posix compliant OSes do provide an executable version of 'cd'.

So the answer to you question is sudo 'echo yo' works by design and sudo 'cd /directory' doesn't because Gnu/Linux does not follow the Posix standard here.

The issue is more for sudo cd to fail on your OS than sudo echo to succeed.

sudo cd /directory is quite a legitimate method to check if a given user, likely root here, is allowed to cd to some directory. That is the reason why all Posix compliant OSes do provide an executable version of cd.

So the answer to you question is sudo echo yo works by design because echo is provided by both a shell alias and an executable command but sudo cd /directory does not because Gnu/Linux is breaking the Posix standard in this specific case.

A simple workaround for your system would be to run sudo sh -c "cd /directory"

added 113 characters in body
Source Link
jlliagre
  • 62.5k
  • 11
  • 123
  • 162

The issue is more for 'su cd'su cd to fail on your OS than 'su echo'su echo to succeed.

'su cd'su cd /directory is quite a legitimate method to check if a given user is allowed to cd to some directory, that's. That is the reason why all Posix compliant OSes dodo provide an executable version of 'cd'. Gnu

So the answer to you question is sudo 'echo yo' works by design and sudo 'cd /directory' doesn't because Gnu/ LinuxLinux does not follow the Posix standard here.

The issue is more for 'su cd' to fail on your OS than 'su echo' to succeed.

'su cd' is quite a legitimate method to check if a given user is allowed to cd to some directory, that's the reason why Posix compliant OSes do provide an executable version of 'cd'. Gnu/ Linux does not follow the Posix standard here.

The issue is more for su cd to fail on your OS than su echo to succeed.

su cd /directory is quite a legitimate method to check if a given user is allowed to cd to some directory. That is the reason why all Posix compliant OSes do provide an executable version of 'cd'.

So the answer to you question is sudo 'echo yo' works by design and sudo 'cd /directory' doesn't because Gnu/Linux does not follow the Posix standard here.

added 184 characters in body
Source Link
jlliagre
  • 62.5k
  • 11
  • 123
  • 162
Loading
Source Link
jlliagre
  • 62.5k
  • 11
  • 123
  • 162
Loading