Questions tagged [positional-parameter]

104 questions
0
votes
0 answers

Is there another paradigm besides positional arguments, keyword arguments and type-based method/function overloading?

I've read someone on the internet pondering parameter negotiation. I could also imagine some experience-based inference. For example: a method has two parameters of the same type. Positional arguments: based on the sequence of listing the…
tuexss
  • 219
  • 2
  • 11
0
votes
1 answer

bash script to cd to value it reads from configuration file

I am having trouble with a bash script that is launched as a subshell from another shell. The script is installed in a number of different environments each of which have a variety of local-specific values set in a single config file per…
Fred Zimmerman
  • 1,178
  • 3
  • 13
  • 29
0
votes
1 answer

trouble understanding difference in 'find' output for bash using prompt, positional parameters

So I am trying to understand the difference between two results in Bash to further my understanding of positional parameters: $ find ./*.md one.md two.md three.md four.md and: $ ./findall.sh ./*.md one.md where findall.sh is: #!/usr/bin/env…
0
votes
1 answer

Best Way To Carry Positional Parameter From Script To Subscript In Linux

I have setup a Crontab that executes the "find" command which then executes a shell script on each of it's arguments. At the very end of the first shell script is another "find" command which executes another shell script. My question: is there a…
0
votes
2 answers

Failed to add Date to Access database

Having a bit of trouble adding birthday data to an Access database. I have tried running the code without 'birthday' getting in the way and it works then. As per my research, 'DBDate' also takes in milliseconds into account and I've tried saving the…
Raj Saha
  • 49
  • 1
  • 7
-1
votes
1 answer

Got an TypeError: conversion() missing 3 required positional arguments When i was coding

When I test this program I get a TypeError: conversion() missing 3 required positional arguments: 'milesPerhour1', 'milesPerhour2', and 'milesPerhour3' So I tried organizing my code so everything related to the conversion function was all in one…
-1
votes
1 answer

positional arguments python crash course?

def build_profile(first, last, **user_info): """Build a dictionary containing everything we know about a user.""" user_info['first_name'] = first user_info['last_name'] = last return user_info user_profile = build_profile('albert', 'einstein', …
-1
votes
3 answers

In bash how to use the last argument- and adding all other arguments to array

I have a script where the user can add as many arguments as he would like (numbers). The script will sum all the numbers beside the last number - The last number (argument) is the number that I need to divide by For example: ./test.sh 2 2 6 5 This…
dzbeda
  • 173
  • 2
  • 9
-1
votes
1 answer

Understanding the meaning of set - - "$@" "-h"

I would like to understand what the following command does set -- "$@" "-h" The gnu manual says -- If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parameters are set to the arguments,…
Nigel
  • 39
  • 4
-1
votes
2 answers

TypeError: __init__() takes 2 positional arguments but 4 were given

My code is giving the error as TypeError: __init__() takes 2 positional arguments but 4 were given. tried searching for an extra argument but couldn't get one. Tried previously answered questions but didn't get any proper solution. My code is as…
Vikesh Patil
  • 9
  • 2
  • 2
  • 5
-1
votes
1 answer

Why is the positional parameter still present after sourcing the script?

I am sourcing a script and the value of the positional parameter is reflecting even after the script is sourced. $ echo $1 $ . $SCRIPTS_DIR/xeye.sh ryadqa Done $ echo $1 ryadqa
summithere
  • 11
  • 4
-1
votes
1 answer

How can I rearrange the outputfile in order to obtain the numbers in lane and separated by a blank space?

Here's my script. It takes only 4 positional parameters. The output should be all the positional parameters, the number of characters that each one has and the first character of each one. #!/bin/bash rm -r param.out declare -i cont cont=$# if […
Pol
  • 1
-1
votes
2 answers

Recursion does not work with positional arguments

I am trying to do multiplication recursion (multiplying all the values of a container) in Python. The function receives the elements of the list as positional argument(*n). On execution I receive the error saying "Maximum recursion depth reached".…
thunde47
  • 59
  • 5
-1
votes
1 answer

Python parameter list with single argument

When testing Python parameter list with a single argument, I found some weird behavior with print. >>> def hi(*x): ... print(x) ... >>> hi() () >>> hi(1,2) (1, 2) >>> hi(1) (1,) Could any one explain to me what the last comma mean in hi(1)'s…
Sang
  • 4,049
  • 3
  • 37
  • 47
1 2 3 4 5 6
7