|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to check user permissions in c shell script
HI ,
I got a bash script for checking whether the script is run by the user root. If the user is not 'root' then I need to run the script. Now I have to write the same code in c-script using switch statement. Can you please tell me how to write this? Following is the code written in bash. case `id` in 'uid=0('*) echo "ERROR: cannot execute as user 'root'" exit 1 ;; uid=?'(mcidas)'* |\ uid=??'(mcidas)'* |\ uid=???'(mcidas)'* |\ uid=????'(mcidas)'* |\ uid=?????'(mcidas)'* |\ uid=??????'(mcidas)'* |\ uid=???????'(mcidas)'* ) MCDATA=$HOME/workdata ;; *) MCDATA=$HOME/mcidas/data ;; esac Thanks, Sridhar. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > how to check user permissions in c shell script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|