19 Jul 21:35
bash (or other shell) help with usernames
Trying to do something simple, but it's not working. Just trying to pass an argument (in this case a username), and have it touch a file in that user's directory. calling the script like this: SCRIPTNAME USERNAME #!/bin/bash touch ~$1/FILENAME Does not work. I get no such directory or file. If I hard code in: touch ~USERNAME/FILENAME Then it works. If I call it with: SCRIPTNAME ~USERNAME (Note the ~) There must be something going on with passing in the username via the command prompt and using that string with tilde expansion. I'm trying to do something when a user connects to an SMB share on linux. I can retrieve the username via $U in the pre-exec area. I could add the full path in SMB.conf, but not all users are in the same path for their home directories. Using the tilde with their username is best. -- -- Roger
RSS Feed