Sponsored Content
Full Discussion: If statements/general help
Top Forums UNIX for Dummies Questions & Answers If statements/general help Post 302467865 by mbf123 on Sunday 31st of October 2010 07:39:39 PM
Old 10-31-2010
If statements/general help

Dear Unix community over the last couple of days I have been working on learning Unix scripting on iOS using terminal on a jail-broken device...
I am having trouble with if statements and giving the user a y or n choice that do different things when entered. The following is my code so far... Please tell me if you would like further explaining on what anything means or what i think it should do.
Thanks in advance,

Code:
#!/bin/bash
# iOS-Ad-Remover
# Marshall Ford @ marshallbford@ gmail.com
# This project is hosted @ http://ios-ad-
# remover.sourceforge.net
# Under the GNU GPL open source license
clear
date
echo
if [ `id -u` != 0 ]; then echo "You need to be root to run this script."; exit 0;
echo
fi
echo
echo "Welcome to iOS-Ad-remover Beta 0.1"
sleep 2
echo
echo "This script is similar to Adblock
in that it will remove ads from most apps,
some websites, and in Cydia."
sleep 1
echo
echo "You will need to meet the following
requirements..."
sleep 3
echo
echo "1. iFile installed and up to date"
sleep 3
echo
echo "2. The modified (hosts) file
that came with this script must located 
@ /var/mobile/Media/Downloads"
sleep 3
echo
echo "3. This script must be located
@ /var/mobile"
sleep 3
echo
echo "Have you completed the requirements
and still want to continue?"
echo
echo "y or n?"
sleep 1
read answer
# if [ "$answer" == 'y' ]; then
 echo "Backing-up"
 cd ..
 cd ..
 cd var/mobile/Media/Downloads
 mkdir backup
 cd ..
 cd ..
 cd ..
 cd ..
 cd etc
 cp fhosts /var/mobile/Media/Downloads/backup
 cd ..
 cd ..
 cd ..
 cd ..
 cd ..
 cd etc
 rm fhosts
fi
# if [ "$answer" == 'n' ]; then
 echo "Ad removal stopped by user."
 sleep 2
 echo "Good Bye"
 sleep 3
#end script

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

General Question

Hi, I've been racking my brains trying to remember, but, whats the command to change the default shell? I'm currently always in the Korn shell and I want to start out in the Bash shell. I'm running a variant of BSD I guess in Mac OS X 10.2.2 and Mandrake. Thanks. ccindyderek:confused: (4 Replies)
Discussion started by: ccindyderek
4 Replies

2. Shell Programming and Scripting

general question?

Perl, Python, and PHP are these languages easy to use? Are they command line or are they part of a GUI? (2 Replies)
Discussion started by: wmosley2
2 Replies

3. UNIX for Dummies Questions & Answers

General Query

Hi all My job is to bootup the servers (1 sun solaris 5.8, 3 sco (release 5) and 1 windows 2000), taking backup of the servers and shut down. Apart from this, there are nearly 150 users for our oracle9i database (forms 3 and d2k as front end). As for as oracle 9i is concerned my job is to... (0 Replies)
Discussion started by: raguramtgr
0 Replies

4. UNIX for Dummies Questions & Answers

general ledger balance.

My general ledger account did not balance to my posting journal. How can I change the general ledger account to balance with my posting journal without having to post a one sided ticket and have it go to my outage account? :confused: (1 Reply)
Discussion started by: Jenny
1 Replies

5. Shell Programming and Scripting

system general information

hi I am new to this forum. hope to get help from u all. how can i write these by using shell programming? 1. The name of the machine and the date/time at which the report was produced. 2. Licensing information such as the operating system revision level and license restrictions in terms of... (1 Reply)
Discussion started by: nokia1100
1 Replies

6. Shell Programming and Scripting

General UNIX Query

Hi all, I am having putty in my system.But I dont have access to any UNIX Servers.Is there any default or common UNIX Server so that anyone can access and be familiar with UNIX and Shell scripting. I want to work and practice in UNIX..Thats why I am asking this question. Kindly give me... (2 Replies)
Discussion started by: dave_nithis
2 Replies

7. Shell Programming and Scripting

awk (?) help or just general script

I have two files (___ represents blanks) Foo1 1000 345 456 1001 876 908 1002 ___ 786 1003 643 908 1004 345 234 and Foo2 1000 345 1001 876 1002 111 1003 643 1004 345 (3 Replies)
Discussion started by: garethsays
3 Replies

8. Programming

General Framework For C

Hi guys. Is there any General Framework for C like other languages?:confused: for example .Net or ... . I googled but i didn't find anything useful. (5 Replies)
Discussion started by: majid.merkava
5 Replies
sensors(1)							Linux User's Manual							sensors(1)

NAME
sensors - print sensors information SYNOPSIS
sensors [ options ] [ chips ] sensors -s [ chips ] sensors --bus-list DESCRIPTION
sensors is used to show the current readings of all sensor chips. sensors -s is used to set all limits as specified in the configuration file. sensors --bus-list is used to generate bus statements suitable for the configuration file. OPTIONS
-c, --config-file config-file Specify a configuration file. If no file is specified, the libsensors default configuration file is used. Use `-c /dev/null' to tem- porarily disable this default configuration file. -h, --help Print a help text and exit. -s, --set Evaluate all `set' statements in the configuration file and exit. You must be `root' to do this. If this parameter is not specified, no `set' statement is evaluated. -A, --no-adapter Do not show the adapter for each chip. -u Raw output. This mode is suitable for debugging and for post-processing of the output by scripts. It is also useful when writing a configuration file because it shows the raw input names which must be referenced in the configuration file. -v, --version Print the program version and exit. -f, --fahrenheit Print the temperatures in degrees Fahrenheit instead of Celsius. --bus-list Generate bus statements suitable for using in sensors.conf. Such bus statements are only needed if you have several chips sharing the same address on different buses of the same type. As bus numbers are usually not guaranteed to be stable over reboots, these statements let you refer to each bus by its name rather than numbers. FILES
/etc/sensors3.conf /etc/sensors.conf The system wide configuration file. See sensors.conf(5) for further details. SEE ALSO
sensors.conf(5) AUTHOR
Frodo Looijaard and the lm_sensors group http://www.lm-sensors.org/ lm-sensors 3 November 2012 sensors(1)
All times are GMT -4. The time now is 06:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy