July 24, 2014, 09:42:23 PM

News : LinuxSolved.com Linux Help Community Forum..


Recent Posts

Pages: 1 ... 8 9 [10]
91
Linux Development & Programming / Re: Shell Scripting Help
« Last post by Chris4610 on November 12, 2012, 06:39:53 PM »
I tried to figure out how to do this long script but I can't figure it out, is there anyone at all that can help me with this?

Ty,

Chris
92
Other Devices / Re: D-link DWA-123 usb wifi adapter on Ubuntu linux
« Last post by sanemdeepak on November 11, 2012, 07:14:34 AM »
lsusb shows the following result

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 002: ID 2001:3c1d D-Link Corp.
93
Other Devices / D-link DWA-123 usb wifi adapter on Ubuntu linux
« Last post by sanemdeepak on November 11, 2012, 07:13:19 AM »
Guys can any one help me to install my D-link DWA-123 usb wireless adapter on ububtu linux. please  :( :( :(
94
Linux Development & Programming / Re: Programming Help
« Last post by Chris4610 on November 09, 2012, 06:52:50 PM »
I thankfully was able to actually work out the answers for the questions I needed help on. But if anyone can please help me with the linux shell scripting post that I made it would really bail me out of a bad mess. I just can't grasp the concept of building scripts by myself.

Ty,

Chris
95
Linux Development & Programming / Re: Shell Scripting Help
« Last post by Chris4610 on November 09, 2012, 06:17:58 PM »
First let me apologize for the posting I am asking for help for this one time, I have had to deal with my future mother in law and father in law almost passing away on us and it led me to fall behind a little. I have also been sick with the flu, so if anyone can please help me with this, i would be grateful. I certainly will still pose a question or 2 in the future but this would be the only time i'd ask for this much help. With my frame of mind trying to understand how to put together this long script is very hard for me, i'm trying to research it and figure it out but I have till Monday and not sure I can do it.

Ty,

Chris
96
Linux Development & Programming / Re: Programming Help
« Last post by Chris4610 on November 09, 2012, 06:16:26 PM »
First let me apologize for the posting I am asking for help for this one time, I have had to deal with my future mother in law and father in law almost passing away on us and it led me to fall behind a little. I have also been sick with the flu, so if anyone can please help me with this, i would be grateful. I certainly will still pose a question or 2 in the future but this would be the only time i'd ask for this much help.

Ty,

Chris

97
Linux Development & Programming / Shell Scripting Help
« Last post by Chris4610 on November 09, 2012, 04:18:02 AM »
Hello Everyone,

    I am looking for help in figuring out exactly what I need to do and if someone can help me figure it out, it would get me out of a huge jam. I am including what i'm being asked to do and will show an example I was given, I was told that the example could be altered to do what is asked below, I just don't understand this script stuff at all.

Ty,

Chris

Case – switch 2,  9 points (3 if it runs correctly, 5 if all components are included and 1 for
comments) and yes we live in a partial credit world.   
This project is an extension of the case and switch assignment from last week.  We have
used all the elements of this script in prior homework projects, puzzles and/or scripts. 
This time around everything is a choice in a case switch script.   
Your shell script will use case and switch and should include the following elements:
some kind of conditional test to proceed (date, verify users is logged, etc)
request the user’s name (save as a variable to be used at exit)
a counter that counts the number of total choices made by the user
a use of the cut command (cut a field from you friends list or some other file)
an option to run 5 different commands (ls, who, ping etc) and 
on exiting the script, echo the user’s name, user inputs (you will want to save
these as varialbes and how many choices the user made).   
Comments MUST be included in the script!  Your script should be easy for anyone to run
without the need of prompting from you, the developer.
Email a copy and leave an executable copy in the appropriate homework directory.
Remember, by reading your comments I should be able to see exactly what your script is
doing (or suppose to do).  Why use comments?  Comments force you to think through the
scripting process.  Scripting could be considered a mechanical process of converting your
comments into UNIX commands.
*** READ the following paragraph to help you with your puzzle!! 
Trouble shooting your script (in case you need it)….  This script has more elements and
more potential to bonk, crash, not work.  What you should do is start with the BASIC C-S
script and start adding elements to the known to work script.  If the script bonks and
before you declare yourself “lost”(remember lost is a television show!), comment out newly
added lines until the script works again.  Now you have a block of code that needs to be
carefully reviewed.  If we were sitting in a face-to-face class this is exactly the process we
[YOU] would be asked to do.  Start with a simple script (the frame work from last week is
a good starting point) and develop it from there, don’t forget to make copies of your work
along the way!!

#! /bin/csh
echo "Enter the month date"
set a = ($<)  frugard
set date = `date | cut -f 3 -d ' '`     #date command cut to the date
        if ( $a == $date ) then         #if correct date entered
        echo "What's your first name ?" #ask for name
        set b = $<                      #setting variable
        echo "Hello $b "
        else
        echo "I'm sorry that is not correct."
        exit 0
        endif
        @ h = 0                         # declaring the variables
        @ i = 0
        @ j = 0
        @ k = 0
        @ l = 0
        @ z = 0
set e = /home/fall_05/user-name/HW/11-22  #path
set f = $e/menu                         #set variable for menu
while (1)
        top:
        clear
        cat $f                          #cat menu
        echo -n "Enter your choice  "
        set a = $<                      #set variable for choice
        #set z = 1                      # the counter wouldn't work until I defined the
variable
        switch ( $a )
                case [aA]:              #case a
                        @ h = 1         # h is equal to 1 this sets the variable
 for listing inputs
                        ls              #command
                        @ z = $z + 1    #The counter
                        sleep 2
          goto top
                case [bB]:
          @ i = 1
                        who
                        @ z = $z + 1
                        sleep 2
          goto top
  case [cC]:
          @ j = 1              last |grep $b |wc -l
                        @ z = $z + 1
                        sleep 2
          goto top
                case [dD]:
          @ k = 1
          finger
                        @ z = $z + 1
          sleep 2
          goto top
                case [eE]:
          @ l = 1
                        @ z = $z + 1
                        echo "Thank you $b for entering $z choices."
                        echo "You ran the following commands "
                                if ( $h == 1 ) then
    echo "ls "              # if h is equal to 1 then echo ls and so
forth following down the line
                                if ( $i == 1 ) then
                                echo "who "
                                endif
                                if ( $j == 1 ) then
                                echo "last "
endif
                                if ( $k == 1 ) then
                                echo "finger "
                                endif
                                if ( $l == 1 ) then
                                echo "exit "
                                endif
        exit 0
                endsw       # end switch
end                     # end while statement #! /bin/csh
#case switch
echo -n "Please enter your name... " #prompts user for name
set name=$<     #sets user input to variable
@ i = 0         #counter begins at zero
@ a = 0
@ new = 0
@ f = 0
@ c = 0
@ n = 0
@ z = 0
@ dir = 0
@ address = 0
while (1)       #while true
echo $i         #counter
clear           #clear screen
top:            #place holder for goto
cat options     #look at option file
@ i = $i + 1    #increment counter at each pass
echo options    #echo options to screen
echo -n "Enter your option... " #prompts user for selection
set z=$<                        #sets user input to variable
switch ($z)
echo ""                         #inserts a blank line
        case [aA]               #chosen if user selects option aA
clear
        echo -n "Which file would you like to copy? " #prompts user for input
        set a=$<                #sets user input to variable
        echo -n "What is the new filename? "    #prompts user for input
        set new=$<              #sets user input to variable
        cp $a $new              #copies one file to another
        echo -n file $a was copied to $new  #displays the file names
        echo ""                 #inserts a blank line
        goto top                #return to the top and start over
        case [bB]               #chosen if user selects option bB
        clear
        echo -n "Which file would you like displayed? " #prompts user for file n
ame
        set f=$<                #sets user input to variable
        if (-e $f) then         #if the file exists then
        cat $f                  #cat the file
        endif       #end if statement
        echo ""                 #inserts a blank line
        echo -n "Which column would you like to cut? "  #prompts user for column
 to cut         set c=$<                #sets user input to variable
        cat $f|tr -s ' ' | cut -f $c -d ' '>duh2 #looks at file, removes spaces,
 cuts field and saves as new file
        echo ""                 #inserts a blank line
        cat duh2                #look at the edited file
        echo ""                 #inserts a blank line
        goto top                #return to the top and start over
        case [cC]               #chosen if user selects option cC
clear
        echo -n "Enter the name of the file that you'd like to look at. " #promp
ts user for input
        echo ""                 #inserts a blank line
        set f=$<                #sets user input to variable
        cat $f                  #performs cat on user input
        goto top                #return to the top and start over
        case [dD]               #chosen if user selects option dD
        clear                   #clear screen
        loop:                   #place holder
        cat options1            #look at the options1 file for additional option
s
        echo options1           #echo the options to the screen
        echo -n "Which function would you like to perform? "
        set i=$<                #sets user input to variable
        switch ($i)
                case [1]
                clear
                echo -n "Which directory would you like to look at? " #ls comman
d, prompts for directory
                set dir=$<      #sets user input to variable.
                ls -alF $dir    #performs ls on directory from user input
                echo ""         #inserts a blank line
                goto loop       #go to loop placeholder
                case [2]
                clear
                echo ""         #inserts a blank line
who             #performs who
                echo ""         #inserts a blank line
                goto loop       #go to loop placeholder
                case [3]
                echo ""         #inserts a blank line
                echo -n "What is the address to ping? " #prompts user for addres
s to ping
                set address=$<  #sets user input to variable
                ping $address -c 1      #performs ping, on user input, for one c
ount
                echo ""         #inserts a blank line                 goto loop       #go to placeholder
                case [4]
                clear
                echo "Who would you like to 'finger'?" #prompts user for name
                set n=$<        #sets user input to variable
                finger $n       #performs finger on variable
                echo ""         #inserts a blank line
                goto loop       #go to placeholder
                case [5]
                goto top        #go to placeholder
        endsw                   #end switch
                case [eE]       #chosen if user selects option eE
        echo -n "You entered option e, to exit. Goodbye $name! $i options were c
hosen. Your inputs were $z, $a, $new, $f, $c, $n, $dir, $address. "          #ec
ho the user's name, how many choices were made and what the inputs were.
                                #displays which option was entered and exits the
echo ""                 #inserts a blank line
        exit                    #exit
        breaksw                 #ends
endsw                           #end the switch
end                             #end the while statement

98
Linux Development & Programming / Programming Help
« Last post by Chris4610 on November 09, 2012, 04:12:06 AM »
Hello,

    I am in need of some help with several programming questions, I am truly lost so if someone can please help me i'd be greatful.

Ty,

Chris

1. Declare a function that is called Compute_Avg. The function returns a float data, receives an integer parameter named “num”, and a float parameter named “Average”.

2.  x = 2, y =1, z =3, what is the value of x, y, z after executing the following codes?
   switch(x)
   {   
      case 0: x =2; y =3;
      case 1: x =3; break;
      default: x=3; y=2 ;
   }

3.  Find any errors in the following function declarations.
   a. int sun(int x, y);
   b. int sun(int x, int y)
   c. void sun(void, void) ;
   d void sun(x int, y float);

4.   What is the output of the code corresponding to the following pseudocode?
   (a)
 X = -5;
if  (X > 0)
   printf(“%d”,X);
if (!((X=0) && (X<0)))
   printf(“Not”);

(b)
      #include<stdio.h>
      #include<stdlib.h>
void print_message(void);
int main()
{
   print_message( );
   printf(“This is a new message.\n”);
   print_message( );
   print_message( );
   printf(“The end.\n”);
   system(“pause”);
   return 0;
}
void print_message( )
{
      printf(“Hello !\n”);
      return;
}


5. If num=5, determine whether each of the following expressions is true or false.
a.   (num*num)>=(2*num)
b.   (3*num-2)<=6


6.  A home mortgage authority requires a deposit on a home loan according to the following schedule:
   Loan$                  Deposit
   Less than $25000            6% of loan value
   $25000-$49000            $1000+10% of loan
   $49000-$100000            $2000+25% of loan
Loans in excess of $100000 are not allowed. Write a program that will read a loan amount and compute and print the required deposit.




7 Write a program that inputs one number, then display “yes” if num = 1, display “no” if num =2, displays “maybe” if num = 3, display “Error message” if num is not 1,2 or 3. Implement this program by a Switch statement.



8.  Write a function float Average(int, int, int, int) that finds the average of four numbers, and then write a main program that inputs four numbers from the user. You need to call the function and display the mean of the four numbers in the main.


The cost of renting a tool is $20 for the first day, $10 per day for the next 3 days and $8 per day thereafter. If the input is the number of days the tool was rented, compute the cost of renting the tool.


99
Os Talk / resolve the disk failiure
« Last post by kalaiselvan on November 07, 2012, 05:54:34 PM »
when i start the ubuntu machine it through the disk failiure error how can i trobleshoot that this kind of problem
100
Linux Kernel / Re: Linux sound. What to set in kernel. Why not buitlin / why module?
« Last post by dalek on November 03, 2012, 12:57:00 AM »
When I get a new system, or build one, I use this site to figure out what drivers I need for hardware:

http://kmuto.jp/debian/hcl/

There are two ways to work this.  Paste the results of lspci -n in the box or use the left side and look up by manufacturer.  First is the best if you have the system and second is best if you are looking to buy or build one. 

Hope that helps. 

 :)   :)
Pages: 1 ... 8 9 [10]