Help writing bash script
Solved/Closed
bashbabe
Posts
3
Registration date
Tuesday September 22, 2009
Status
Member
Last seen
October 25, 2009
-
Sep 22, 2009 at 08:00 PM
Stampy - Oct 5, 2009 at 08:43 AM
Stampy - Oct 5, 2009 at 08:43 AM
Related:
- Help writing bash script
- Structure should be followed while writing the body of an email - Guide
- Bash reverse file - Guide
- Bash read file line by line - Guide
- Bash: htop: command not found - Guide
- Anu script manager 7.0 free download filehippo ✓ - Excel Forum
1 response
HI there,
i am also new to bash scripting but i think it should look something like this
--------------------------------------------------------------------------------------
#!/bin/bash
#Create a file test.txt in lab1 directory
cd /??/<path to lab1>
touch text.txt
#if file exists, Inform user, Delete existing file, Create new file
if [ -f text.txt ]
then echo "File Exists"
rm text.txt
touch text.txt
fi
#change permissions of text.txt, Display exit status
chmod 755 text.txt
echo $?
#Display contents of lab1
ls
exit 0
--------------------------------------------------------------------------------------
Hope it helps/works let me know :)
Glenn
i am also new to bash scripting but i think it should look something like this
--------------------------------------------------------------------------------------
#!/bin/bash
#Create a file test.txt in lab1 directory
cd /??/<path to lab1>
touch text.txt
#if file exists, Inform user, Delete existing file, Create new file
if [ -f text.txt ]
then echo "File Exists"
rm text.txt
touch text.txt
fi
#change permissions of text.txt, Display exit status
chmod 755 text.txt
echo $?
#Display contents of lab1
ls
exit 0
--------------------------------------------------------------------------------------
Hope it helps/works let me know :)
Glenn
Oct 4, 2009 at 09:21 PM
I meant to write earlier and tell you how much I appreciated your help. It worked!
Thanks.
Bashbabe
Oct 5, 2009 at 08:43 AM
Stampy