Link to home
Start Free TrialLog in
Avatar of hankknight
hankknightFlag for Canada

asked on

Linux: Create file with .sh script containing username

I want a .sh script that will create a new file named "me.txt" and that new file should contain the username of the user who ran the script.
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

Try something like in this example

#!/bin/bash
echo "Testing" > "$USER".txt

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial