Anyone with idea in bash script

Feb 6, 2015
23
11
I have a project due 7th march 2016. I have to create an Atm script with three users with their different data and password. If you have idea please help. thank you for reading.
 
I have a project due 7th march 2016. I have to create an Atm script with three users with their different data and password. If you have idea please help. thank you for reading.

Okay, first question is NOT clear at all. Describe more about system architecture, where script is invoked. Is this script doing remote job executions? Receive results or pipe results? What does script do?
Second, is this homework? Share what you have done, because we have no idea what is ATM script.

Don't forget Linux distro and version you are using for faster response.

Just hints:
Code:
su -c "Your command right here" -s /bin/sh username

this will change the directory to a specific user directory in the group.
Code:
#!/bin/bash

if [ $UID -eq 0 ]; then
  user=$1
  dir=$2
  cd "$dir"
  exec su "$user" "$0" "$@"
fi

echo "This will be run from user $UID"

All The Best.
 
Thanks for your reply let me show u were have reached my only problem is inserting all the three users with ther different accounts
Okay so you have neither responded to Stefano nor I, Noel correctly.

Since its a homework, you also have to read.

You need to have functions to perform specific tasks.
You shall need switch statements to control your program execution.

for learning, run the following as root.
Code:
find /etc/ -type f -iname "*.sh" | xargs cat | less
simply learn how the bash functions are written and invoked.

BASH Programming - Introduction HOW-TO
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html
From Power Up To Bash Prompt
http://tldp.org/LDP/abs/html/index.html [ read after finishing the above guides]

Goodluck
 
Okay so you have neither responded to Stefano nor I, Noel correctly.

Since its a homework, you also have to read.

You need to have functions to perform specific tasks.
You shall need switch statements to control your program execution.

for learning, run the following as root.
Code:
find /etc/ -type f -iname "*.sh" | xargs cat | less
simply learn how the bash functions are written and invoked.

BASH Programming - Introduction HOW-TO
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html
From Power Up To Bash Prompt
http://tldp.org/LDP/abs/html/index.html [ read after finishing the above guides]

Goodluck
thanks its now working
 
Back
Top Bottom