Sponsored Content
Homework and Emergencies Homework & Coursework Questions Having issues finishing up a few scripting problems. A little help would be awesome Post 302919929 by sea on Sunday 5th of October 2014 05:23:29 PM
Old 10-05-2014
env is not really a program to use, but one to get infos from.
Actualy, the variables there show either what you have set in the shell, or have been loaded to the shell (by sourcing or exporting -- but thats, for the moment, beyond your needs).

As you dont it for yourself, why do it at all?

As of now, i might have one my moments, but i'm getting sick by people who cant even accomplish a simple test by their own.
Its nothing difficult, just DO IT and SEE what happens- that is called 'a learning process'... learning by doing...

To be mean, dont attend the accelerated class, but go to the basic class if you cant handle this (i'm even stunned this is called accelerated).
Heck, i'm not allowed in advanced classes because i dont have a 'basic' class visisted... reading this makes me sick...

And to be 'teachfull' nontheless... cat prints out all the content of the passed file.
Which in this case is the variable $filename, which you can set to ANYTHNG you like... like filename="$1"
The $( CODE ) around that command, executes the CODE and prints/execute it (depends on the rest of the line).
Do the above exmaple i told you, and you WILL understand... - if not, read again my 'mean' part...

EDIT2:
I wrote the 'mean' part as i didnt feel you were even following vbe's suggestions...

EDIT3:
Sorry if i was too harsch, might sound harder since i have to translate it to a foreign language...
I just wanted to make you do (show) more 'effort' of your own.

EDIT4:
Sorry didnt see you've edited your post...
You tried:
Code:
pwd
var=$ ( pwd )
if var = $HOME
then
echo you are in the home directory
else
echo you are not in the home directory

Lines:
1) pwd is a command and is executed
2) tries to set var to the output of pwd, fix the space issue, and it'll work
3) the condition misses encapsuling [ and ], however i suggest to (get used to) use [[ and ]]
4) good
5) encapsule the STRING by quotes ", recomended, eventhough in this example it'll work this way...
6) good
7) see 5)
8) missing closing fi

Fix these issues and see what happens Smilie

Last edited by sea; 10-05-2014 at 07:56 PM..
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scripting problems

Hello, Im trying to write a script where it will only execute on a certain day. What would the script look like? if then do this is this correct?? (13 Replies)
Discussion started by: lewisoco
13 Replies

2. Shell Programming and Scripting

Shell scripting issues

hi, I am stuck in a shell script where in i need to extract the specific users from \etc\passwd file. Once this is done, i need to assign Roles to these users which are different for different users. What could be the optimum solution. If i hard code the Roles values in a text file, how would i... (1 Reply)
Discussion started by: ashutosh101
1 Replies

3. UNIX for Dummies Questions & Answers

scripting issues...

Hi guys, I am thanks in advance for any posts and for reading. I am trying to run this script, under solaris: echo "****************************************" echo "The host is: " echo "****************************************" <<EOF find /etc/default -name login -exec ls -l {} \; find... (5 Replies)
Discussion started by: B14speedfreak
5 Replies

4. UNIX for Dummies Questions & Answers

help in finishing 2 commands

the first one: 1. i am trying to build a command that searches a text file and outputs the number of words which consists of two 'b' characters in each word separatly like barby (the b characters must be separated from one another) i tried to use grep filepath then i know that we need... (3 Replies)
Discussion started by: newby2
3 Replies

5. Shell Programming and Scripting

Unix scripting problems

Hi, In my unix server, i received a file in /usr/data/xmit location. i want to write a unix script after file reached. So how can i write a one line code which chceks the presence of the file? and second line line should take the status of the prevous line. like below. Line 1: checks for the... (16 Replies)
Discussion started by: JSKOBS
16 Replies

6. Shell Programming and Scripting

Scripting users issues...

Hello everyone, I am new to the forum community and need help with some scripts. I have attached what I have so far and these are scripts that have been passed on to me for a project that I have been assigned. To tell the truth I have never really worked with scripts and have no clue how these even... (3 Replies)
Discussion started by: wingzero89
3 Replies

7. Shell Programming and Scripting

Issues with scripting users

Hello everyone, I am new to the forum community and need help with some scripts. First off let me put that this is “NOT” a homework assignment as I have been given this information where I work (IUPUI-UITS) and need help on this since I have no experience in this area. The only reason I am turning... (1 Reply)
Discussion started by: wingzero89
1 Replies

8. Shell Programming and Scripting

Issues with awk scripting for HTML tags

Below is the data file(results) contents- 13450708,13470474,US,15 24954,24845,JPN,44 14258992,14365059,US,4 24954,24845,IND,44 I want to send above data sets to email in a tabular format. For that I am using below awk script. Now the challenge I am facing here is - I want to make the... (2 Replies)
Discussion started by: Roseline
2 Replies
All times are GMT -4. The time now is 09:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy