ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have been given an assignment for school, and well, I have no idea how to do it. Linux was not a pre-requisite for this class, and our book does not cover this or Linux at all. Our teacher still thinks we should somehow know how to do this. I have to write this in a UNIX prompt thing I telnet into, it says Red Hat Release 7.2 (Enigma) at the top. Below that it says Kernel 2.4.9-34smp on an i686.
I have looked all over the net at shell script tutorials but none have helped me progress to any point. I am not asking anyone to do my homework for me, I just need someone to point me in the right direction. I do not know anyone with linux or anyone who even uses it. I do not know what to do and I have nothing to turn to for help.
This is what is expected of me by tomorrow night:
-----------------------------------------------------------------------------------------------
2. Create a Linux batch file that at login time would set up your session’s environment so that the following “new” commands could be used for the standard Linux operating systems commands. Test the file to make sure that it works. Append this batch file to the above-mentioned Word file.
A. System prompt is changed to YOURLASTNAME (10 points)
B. Ultrix commands are replaced by the following (=> means replaced by): (30 points)
Well that's all easy stuff.
I'm not sure what your teacher means by a linux "batch file" sounds like a windows thing to me. You can accomplish the above with a shell script that exports different env $vars. Another way you could use your .profile or .bashrc.
But if your teacher wants you to turn in a script then, you should write one in bash.
Thanks for helping, I made the file using VI and named the file batch. I run the file using ./batch and then it runs and then I get another prompt. But nothing changes, and the aliases dont work. Im confused to say the least. It doesnt give me any errors when I run the file.
Well you didn't get any errors and you promt changed. Looks like your on your way!
Why don't you try some of the alias you created? Do they work? e.g. After running it and you execute, "ddt" do you get the date and time or do you get, "bash: ddt: command not found"?
it doesn't change or anything because when you execute a
program like " ./batch" that is lauching a completely seperate
program (another shell actually, kinda like temporarily telnetting
to the same host) so the things insisde of "batch" only works for
that seperate program
(.. and you get another prompt because that program "batch"
exited)
to make it effective in your current shell (what you get when
you telnet), just do: ". ./batch"
NOTE the beginning "." (dot)
i.e. <dot> <space> <dot><slash>batch
this makes it so that all the things inside batch act like you're
typing it into the command line (your current shell)
now you should see the change immediately after that.
try using the fcp aliased command you created on any file.
e.g. "fcp <pick a file> mynewfile"
because those commands inside of batch affect the current shell
once you do ". ./batch" (btw, the process is called "sourcing" a
file), if anythign goes really bad like certain usual commands
don't work, just exit your telnet session and log back in again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.