Skip to main content

Questions tagged [arguments]

An argument is usually defined as the actual value passed to a function, procedure, or command line program.

153 votes
11 answers
58k views

Consider the following code: foo () { echo $* } bar () { echo $@ } foo 1 2 3 4 bar 1 2 3 4 It outputs: 1 2 3 4 1 2 3 4 I am using Ksh88, but I am interested in other common shells ...
rahmu's user avatar
  • 20.6k
80 votes
3 answers
100k views

I was under the impression that the maximum length of a single argument was not the problem here so much as the total size of the overall argument array plus the size of the environment, which is ...
Graeme's user avatar
  • 34.7k
239 votes
7 answers
673k views

I've a command that outputs data to stdout (command1 -p=aaa -v=bbb -i=4). The output line can have the following value: rate (10%) - name: value - 10Kbps I want to grep that output in order to store ...
Paul's user avatar
  • 2,391
11 votes
2 answers
30k views

Consider that there are countless number of files under /src/ cp /src/* /dst/ How many files cp will successfully process?
Mike's user avatar
  • 113
114 votes
8 answers
58k views

I am wondering whether there is a general way of passing multiple options to an executable via the shebang line (#!). I use NixOS, and the first part of the shebang in any script I write is usually /...
Rastapopoulos's user avatar
136 votes
10 answers
219k views

I have a folder with more than a million files that needs sorting, but I can't really do anything because mv outputs this message all the time -bash: /bin/mv: Argument list too long I'm using this ...
Dominique's user avatar
  • 5,475
15 votes
3 answers
5k views

I need to indirectly reference a variable in the bash shell. I basically want to what you can do in make by writing $($(var)). I have tried using ${$var} which would be the most straight forward ...
wefwefa3's user avatar
  • 1,445
89 votes
5 answers
169k views

I get the following error when trying to ls *.txt | wc -l a directory that contains many files: -bash: /bin/ls: Argument list too long Does the threshold of this "Argument list" dependent on distro ...
user avatar
75 votes
3 answers
10k views

I noticed some time ago that usernames and passwords given to curl as command line arguments don't appear in ps output (although of course they may appear in your bash history). They likewise don't ...
Wildcard's user avatar
  • 37.5k
46 votes
7 answers
4k views

cd - can switch between current dir and previous dir. It seems that I have seen - used as arguments to other commands before, though I don't remember if - means the same as with cd. I found that - ...
Tim's user avatar
  • 107k
33 votes
2 answers
34k views

I could use the either form to execute the cat method: cat file_name cat < file_name The result is the same Then I want to execute man in the format of stdin man < file_name While file_name ...
steveyang's user avatar
  • 1,141
27 votes
4 answers
13k views

I wonder when we should use pipeline and when we shouldn't. Say for instance, to kill certain process which handling pdf files, the following will not work by using pipeline: ps aux | grep pdf | awk '{...
sylye's user avatar
  • 718
22 votes
2 answers
44k views

I would like to write a bash script with unknown amount of arguments. How can I walk through these arguments and do something with them? A wrong attempt would look like this: #!/bin/bash for i in $...
rubo77's user avatar
  • 30.7k
10 votes
2 answers
7k views

In the manual for the ps command on Ubuntu there is this text: This version of ps accepts several kinds of options: 1 UNIX options, which may be grouped and must be preceded by a dash. ...
YarLinux's user avatar
  • 1,203
9 votes
1 answer
4k views

I suddenly realized I don't know how to execute things over SSH. I tried to do $ ssh user@server sh -c 'echo "hello"' but it outputs nothing, or rather, it outputs an empty line. If the command ...
Kusalananda's user avatar
  • 358k

15 30 50 per page
1
2 3 4 5
7