All Questions
Tagged with variable-substitution command-line
10 questions
0
votes
1
answer
26
views
Error in defining Variables
I am trying to follow this to replace a multiline text.
But to do that I want to put some text like below into a variable.
```dataview
TABLE WITHOUT ID page-no as no, link(file.name, topic) as name ...
0
votes
2
answers
2k
views
Using grep and command line argument
I have a file f1 with contents:
james john joe
marie james
joe
don marie
I want to output the occurrence of the command line arguments in each line using grep in a shell script s1.sh with ...
0
votes
0
answers
18
views
cd command to a variable containing a path with spaces gives different output than actually giving the path as an input [duplicate]
I have a directory named "test 1" and I create a variable
dest="test\ 1"
I want to navigate to the directory using the cd command, so I type
cd $dest
which gives the output as
-...
8
votes
2
answers
5k
views
Behaviour of bash command substitution with command from string in variable
$ echo $(echo x; echo y)
x y
$ a='echo x; echo y'
$ echo $($a) # expect 'x y'
x; echo y
Why does command substitution behave in such way?
How to perform the command substitution for list of commands ...
2
votes
1
answer
204
views
Wordsplitting occurring in quoted variable
I'm trying to create a dialog menu based on the results of the lsblk command. My goal is to read the first word as the menu item and the remaining words as the menu item description.
For example:
...
1
vote
1
answer
443
views
Possible to reuse first argument of BASH line in the same line?
I do this in BASH
echo test "$1"
..expecting to get..
test test
..but I get..
test
Is this something possible to do? It would make my life easier since having a list files I could do something like ...
0
votes
2
answers
838
views
What's the proper way to use a variable with spaces in part of a shell script command? [duplicate]
How can I include spaces as part of a variable used in an svn command for RHEL bash scripting? Or if there's something else wrong with the following, please advise.
The SVN URL variable has no spaces,...
2
votes
1
answer
6k
views
awk with variables in condition and in output redirection file
I would please like some help with this command because I didn't find anything in documentation that can cover everything I want.
I have some variables that are global, so I would prefer to keep them ...
3
votes
2
answers
1k
views
Why does $var give the value of $0?
I have written a very simple awk script that reverses every word of a file-:
awk '
{
for (i=1;i<=NF;i++)
{ x=""
for(j=length($i);j>0;j--)
x=x substr($0,j,1);
print x
}}' file1
The contents of ...
-2
votes
1
answer
152
views
how do I make a $VAR empty so it don't effect the command line argument and still be within that argument?
This is the basic setting for hsetroot for it to work: hsetroot -center /path/to/image/ - setting the wallpaper with just that the picture. To use these options, just one has to be place within the ...