How to store a filename currently *.jpg reading in command rm *.jpg? [closed]
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
-1
down vote
favorite
I want to use the filename currently used by *. How to get the name of the file?
command-line gnome-terminal wildcards
closed as unclear what you're asking by Yaron, Arronical, dessert, vidarlo, Eric Carvalho Feb 14 at 13:53
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |Â
up vote
-1
down vote
favorite
I want to use the filename currently used by *. How to get the name of the file?
command-line gnome-terminal wildcards
closed as unclear what you're asking by Yaron, Arronical, dessert, vidarlo, Eric Carvalho Feb 14 at 13:53
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
2
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
â Yaron
Feb 14 at 9:14
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I want to use the filename currently used by *. How to get the name of the file?
command-line gnome-terminal wildcards
I want to use the filename currently used by *. How to get the name of the file?
command-line gnome-terminal wildcards
command-line gnome-terminal wildcards
edited Feb 14 at 9:23
![](https://i.stack.imgur.com/smMAw.jpg?s=32&g=1)
![](https://i.stack.imgur.com/smMAw.jpg?s=32&g=1)
Arronical
12.7k84589
12.7k84589
asked Feb 14 at 9:11
DENSETSU
1
1
closed as unclear what you're asking by Yaron, Arronical, dessert, vidarlo, Eric Carvalho Feb 14 at 13:53
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by Yaron, Arronical, dessert, vidarlo, Eric Carvalho Feb 14 at 13:53
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
2
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
â Yaron
Feb 14 at 9:14
add a comment |Â
2
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
â Yaron
Feb 14 at 9:14
2
2
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
â Yaron
Feb 14 at 9:14
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
â Yaron
Feb 14 at 9:14
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
1
down vote
If you want to use the star char *
usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the *
with a backslash . Example:
$ touch '*.jpg'
$ touch 'mypicture.jpg'
$ ls
'*.jpg' mypicture.jpg
$ rm '*.jpg'
$ ls
mypicture.jpg
You can also use the same script with *.jpg
instead of '*.jpg'
.
We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
â Arronical
Feb 14 at 9:23
@Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
â tobiasBora
Feb 14 at 9:37
add a comment |Â
up vote
0
down vote
*.jpg
will expand to every .jpg file in the current directory. If you execute rm *.jpg
, all of those files will be deleted. The shell expansion of the wildcard *
does not store the results as separate variables, or give you a way to reference individual results within the expansion set.
If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:
for file in *.jpg; do
echo "$file"
done
Will echo
each of the files matched by *.jpg
. You can of course use much more complex commands inside the loop, including other conditional statements such as if
statements.
add a comment |Â
up vote
0
down vote
To show all the files indicated by *.jpg
type:
ls *.jpg
The command rm *.jpg
will remove all of these files.
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
If you want to use the star char *
usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the *
with a backslash . Example:
$ touch '*.jpg'
$ touch 'mypicture.jpg'
$ ls
'*.jpg' mypicture.jpg
$ rm '*.jpg'
$ ls
mypicture.jpg
You can also use the same script with *.jpg
instead of '*.jpg'
.
We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
â Arronical
Feb 14 at 9:23
@Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
â tobiasBora
Feb 14 at 9:37
add a comment |Â
up vote
1
down vote
If you want to use the star char *
usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the *
with a backslash . Example:
$ touch '*.jpg'
$ touch 'mypicture.jpg'
$ ls
'*.jpg' mypicture.jpg
$ rm '*.jpg'
$ ls
mypicture.jpg
You can also use the same script with *.jpg
instead of '*.jpg'
.
We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
â Arronical
Feb 14 at 9:23
@Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
â tobiasBora
Feb 14 at 9:37
add a comment |Â
up vote
1
down vote
up vote
1
down vote
If you want to use the star char *
usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the *
with a backslash . Example:
$ touch '*.jpg'
$ touch 'mypicture.jpg'
$ ls
'*.jpg' mypicture.jpg
$ rm '*.jpg'
$ ls
mypicture.jpg
You can also use the same script with *.jpg
instead of '*.jpg'
.
If you want to use the star char *
usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the *
with a backslash . Example:
$ touch '*.jpg'
$ touch 'mypicture.jpg'
$ ls
'*.jpg' mypicture.jpg
$ rm '*.jpg'
$ ls
mypicture.jpg
You can also use the same script with *.jpg
instead of '*.jpg'
.
edited Feb 14 at 9:58
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
dessert
20k55795
20k55795
answered Feb 14 at 9:20
tobiasBora
86469
86469
We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
â Arronical
Feb 14 at 9:23
@Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
â tobiasBora
Feb 14 at 9:37
add a comment |Â
We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
â Arronical
Feb 14 at 9:23
@Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
â tobiasBora
Feb 14 at 9:37
We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
â Arronical
Feb 14 at 9:23
We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
â Arronical
Feb 14 at 9:23
@Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
â tobiasBora
Feb 14 at 9:37
@Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
â tobiasBora
Feb 14 at 9:37
add a comment |Â
up vote
0
down vote
*.jpg
will expand to every .jpg file in the current directory. If you execute rm *.jpg
, all of those files will be deleted. The shell expansion of the wildcard *
does not store the results as separate variables, or give you a way to reference individual results within the expansion set.
If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:
for file in *.jpg; do
echo "$file"
done
Will echo
each of the files matched by *.jpg
. You can of course use much more complex commands inside the loop, including other conditional statements such as if
statements.
add a comment |Â
up vote
0
down vote
*.jpg
will expand to every .jpg file in the current directory. If you execute rm *.jpg
, all of those files will be deleted. The shell expansion of the wildcard *
does not store the results as separate variables, or give you a way to reference individual results within the expansion set.
If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:
for file in *.jpg; do
echo "$file"
done
Will echo
each of the files matched by *.jpg
. You can of course use much more complex commands inside the loop, including other conditional statements such as if
statements.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
*.jpg
will expand to every .jpg file in the current directory. If you execute rm *.jpg
, all of those files will be deleted. The shell expansion of the wildcard *
does not store the results as separate variables, or give you a way to reference individual results within the expansion set.
If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:
for file in *.jpg; do
echo "$file"
done
Will echo
each of the files matched by *.jpg
. You can of course use much more complex commands inside the loop, including other conditional statements such as if
statements.
*.jpg
will expand to every .jpg file in the current directory. If you execute rm *.jpg
, all of those files will be deleted. The shell expansion of the wildcard *
does not store the results as separate variables, or give you a way to reference individual results within the expansion set.
If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:
for file in *.jpg; do
echo "$file"
done
Will echo
each of the files matched by *.jpg
. You can of course use much more complex commands inside the loop, including other conditional statements such as if
statements.
edited Feb 14 at 9:59
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
dessert
20k55795
20k55795
answered Feb 14 at 9:21
![](https://i.stack.imgur.com/smMAw.jpg?s=32&g=1)
![](https://i.stack.imgur.com/smMAw.jpg?s=32&g=1)
Arronical
12.7k84589
12.7k84589
add a comment |Â
add a comment |Â
up vote
0
down vote
To show all the files indicated by *.jpg
type:
ls *.jpg
The command rm *.jpg
will remove all of these files.
add a comment |Â
up vote
0
down vote
To show all the files indicated by *.jpg
type:
ls *.jpg
The command rm *.jpg
will remove all of these files.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
To show all the files indicated by *.jpg
type:
ls *.jpg
The command rm *.jpg
will remove all of these files.
To show all the files indicated by *.jpg
type:
ls *.jpg
The command rm *.jpg
will remove all of these files.
answered Feb 14 at 11:11
![](https://i.stack.imgur.com/zqElV.png?s=32&g=1)
![](https://i.stack.imgur.com/zqElV.png?s=32&g=1)
karel
51.6k11107131
51.6k11107131
add a comment |Â
add a comment |Â
2
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
â Yaron
Feb 14 at 9:14