1.Creates a text file that lists the operating system of your computer, the computers name and username. Use appropriate environmental variables.
2.Append to the text file a listing of the files and folders in the current directory.
3.Create a variable called myName and assign your last name to this variable.
4.Create a directory that uses the value of the myName variable as the directory name.
5.Copy the report text file into the newly created directory.

I have abslolutely no idea how to do it. I would appreciate any form of help. Thank You.

Just so you know, they strongly discourage putting homework or work requests up oh this board. I don't run it; just thought you should know.

That being said, all the other boards are dead, so :

#!/bin/ksh

echo `uname -a` >>file.txt
echo `hostname` >>file.txt
echo $LOGNAME >>file.txt
ls -d * >>file.txt
myName=whateverYourLastNameIs
mkdir $myName
mv file.txt ${myName}/.

Good luck :)

Admin's: Apologies if replying to these kind of posts is absolutely taboo

, Mike

I just don't know how to thank You, you saved my life!!! I was basically looking for an advice or a sample script, but thank you for doing this for me. I'm taking an online programing logic and basic scripting class and for some reason the instructor isn't very much helpful. Hope I can help you some day too. Thx,Egor

Create a shell script that will do the following:


Creates a text file that lists the operating system of your computer, the computers name and username. Use appropriate environmental variables.
Append to the text file a listing of the files and folders in the current directory.
Create a variable called myName and assign your last name to this variable.
Create a directory that uses the value of the myName variable as the directory name.
Copy the report text file into the newly created directory.
At the top of the script you should include comments that indicate the purpose of the script, your name and the course number.

See above ;)

, Mike

@echo off
rem **************************
rem * Author: Your Name
rem * Created: 03/29/2009
rem * Purpose: Demonstration Script
rem ************************

rem Create a text file that lists the operating system of your computer,
rem the computer's name and username.
echo Operating system: %OS% > report.txt
echo Computer name: %COMPUTERNAME% >> report.txt
echo User name: %USERNAME% >> report.txt

rem Append to the text file a listing of the files and folders in the
rem current directory.
dir >> report.txt

rem Create a variable called myName and assign your last name to this variable.
set myName=Castro

rem Create a directory that uses the value of the myName variable as
rem the directory name.
md %myName%

rem Copy the report text file into the newly created directory.
copy report.txt %myName%

commented: Batch Files != Shell Scripts / TASTE IT! -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.