Sponsored Content
Top Forums Shell Programming and Scripting Second parameter is not recognized Post 302536769 by Eclecticaa on Wednesday 6th of July 2011 07:50:17 AM
Old 07-06-2011
Second parameter is not recognized

Hey I have a problem with my script.
I writing a script which can depend whether you want to make a file or a directory.
I only give the code where you can find the problem.
My loop doesn't stop and I don't know why and
when i echo my second parameter , he echoes nothing :s

Thnx

Code:
function files()
{
 local var=$2;
 for (( i=1;i -le $var;i++))               
 do
  touch test$i /home/arian/Bureaublad/scripts
  echo $i
done
}

case $1 in
  "-f")files $2;;
    *) echo "foutieve ingave ! optie + aantal bestanden/mappen";;
esac

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Argument not recognized as integer

I need to accept a number of arguments at command line and print it in reverse order i use eval `echo x=$1` to capture the argument #! /bin/sh counter=0 while do eval `echo x=$1` arg$counter=$x counter=`expr $counter + 1` shift done but the error keeps... (1 Reply)
Discussion started by: scmay
1 Replies

2. Forum Support Area for Unregistered Users & Account Problems

I am not being recognized

Hi Admin, My user id is "chanakyahere", i forgot my password. When i give my mail id "chanakyahere@gmail.com" it is not being accepting by webmaster. But to the same mail id i got reply to one of my questions. The same mail id i gave while registering in this site. This i can confirm as... (0 Replies)
Discussion started by: Help
0 Replies

3. Shell Programming and Scripting

how do I make dynamic parameter names? Or get the value of a parameter evaluated twi

Say I write something like the following: var1=1 var2=2 for int in 1 2 do echo "\$var$int" done I want the output to be: 1 2 Instead I get something like: $var1 $var2 (2 Replies)
Discussion started by: Awanka
2 Replies

4. UNIX for Dummies Questions & Answers

jar command not being recognized

Hi, I'm trying to extract a war file via the jar command; however, when I issue: jar -xvf MyWarFile.war I'm recieving "jar: not found" I added /usr/bin to the path ...didn't work also tried /usr/bin/jar to the path...still doesn't work My JAVA_HOME/bin is also in the path. ... (1 Reply)
Discussion started by: orahi001
1 Replies

5. Solaris

New volume set not recognized

Good evening, I am fairly (re)new to Solaris 10. In fact I was even quite good at it, but that was about 10 years ago, so now I am back to beginner status :) I installed a new machine with an internal 16port RAID attached to an Areca 1260 controller. Also attached is an external SCSI-Raid. ... (7 Replies)
Discussion started by: PatrickBaer
7 Replies

6. Linux

PCI Card recognized

I installed PCI Card HP SC44Ge - SAS1068E on my linux CentOS 5.4 is there a way to find out if the PCI is properly installed and recognized by linux. lspci is enough? just to add that PCI card is connected to a tape... also how can I find out driver and firmware version? thanks a... (1 Reply)
Discussion started by: karlochacon
1 Replies

7. Shell Programming and Scripting

$1 argument not being recognized

I am working on AIX 6.1 issuing #!/bin/sh at the beginning of the script. I don't understand why $1 is not working as expected. I expect it to hold the value for the first argument coming from the command line consistently - and it is not. At the beginning of the script starting I do this:... (4 Replies)
Discussion started by: Feliz
4 Replies

8. Shell Programming and Scripting

Alias not recognized within script

What would cause a script to work under one user account and not another? Here's an example of what I'm referring to. Here's a simple script. Let's put it in a file called “thescript”. #! /bin/bash alias a='echo hello world' a Here are the results when this script is executed logged in... (3 Replies)
Discussion started by: sszd
3 Replies

9. Shell Programming and Scripting

Command that takes one parameter and then searches for the passed in parameter

Hi I am looking for a unix command or a small shell script which can takes one parameter and then searches for the passed in the parameter in any or all files under say /home/dev/ Can anyone please help me on this? (3 Replies)
Discussion started by: pankaj80
3 Replies

10. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies
service(8)						      System Manager's Manual							service(8)

NAME
service - run a System V init script SYNOPSIS
service SCRIPT COMMAND [OPTIONS] service --status-all service --help | -h | --version DESCRIPTION
service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to /. The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the invoked script, service passes COMMAND and OPTIONS it to the init script unmodified. All scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start command. service --status-all runs all init scripts, in alphabetical order, with the status command. If the init script file does not exist, the script tries to use legacy actions. If there is no suitable legacy action found and COMMAND is one of actions specified in LSB Core Specification, input is redirected to the systemctl. Otherwise the command fails with return code 2. FILES
/etc/init.d The directory containing System V init scripts. ENVIRONMENT
LANG, TERM The only environment variables passed to the init scripts. SEE ALSO
chkconfig(8), ntsysv(8), systemd(1), systemctl(8), systemd.service(5) Jan 2006 service(8)
All times are GMT -4. The time now is 02:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy