Skip to main content

All Questions

Tagged with
0 votes
0 answers
21 views

How do make a custom command to be executed directly from a folder using bash

I want to create a custom command that executes a bash script when a use types it in the terminal. So for example when they type in project setup it executes the setup bash script and then they can ...
Caden's user avatar
  • 25
-1 votes
0 answers
22 views

source $HOME/.bash_profile does not save the Output after reboot

I have created a simple Shell script using the below commands. # Setting the JAVA_HOME PATH in .bash_profile. NOTE: - We need to run this only if we are downloading the Java and running it manually. ...
Support Test email account's user avatar
-1 votes
0 answers
12 views

character like '\' coming in SQL output while assigning the output to a variable in shell script [duplicate]

I am trying to run a SQL query in shell script and assigning its output to a variable. When I run the script in Putty in the output variable character like \ is coming in data. But when I run the same ...
Rohit Bansal's user avatar
0 votes
1 answer
39 views

sed command is not replacing the files in my directory [duplicate]

When I run my bash script(given below) the files are not changed. The replacement does not happen for some reason. I am running the command as sudo, and the html folder has permssions 775 with the ...
Gavin Mitchel Dundee's user avatar
-2 votes
0 answers
24 views

Unable to read multiple output returned from a sql query in shell script [closed]

How can I read multiple columns output from a sql and assign them to a variable and then read each row returned one by one and use those variables in each loop run to perform my if else function ...
Rohit Bansal's user avatar
0 votes
1 answer
38 views

How to assign the result of mysqldump command into a variable?

In my bash script, I have tried dumpresult=$(mysqldump --user="${dbuser}" --password="${dbpw}" ${dbname} > ${desdir}/${filename_sql}) and dumpresult=`mysqldump --user="${...
Gary U.U. Unixuser's user avatar
1 vote
2 answers
77 views

How to delete all files except the last day files in Linux?

Suppose these are my files: file1 ==> 2024/07/10 file2 ==> 2024/07/9 file3 ==> 2024/07/9 file4 ==> 2024/07/8 I'm going to delete all files, except files which create date is yesterday (...
Saeed's user avatar
  • 3,865
0 votes
0 answers
36 views

Why timeout works differently when executed from terminal vs from a shell script file

I wanted to implement a unit testing shell script file that runs a command, compares the expected and actual output, and also add timeout constraints. I used actual=$(timeout 2s ./bf --file ./test/inc-...
Seniru Pasan's user avatar
0 votes
2 answers
82 views

Bash: Reading in a string from a file with variable substitution

I have a weird situation where I have a command stored in a file and that file contains references to variables. I'm able to read the file just fine, but I'm having trouble getting variable expansion ...
SailorCire's user avatar
0 votes
0 answers
38 views

For loop of bash script not working, reading lthe next lines within the previous loop [duplicate]

I cannot solve the for loop error in bash script. The bash script is for extracting data from remote server, copying mapped files locally, and then executing a tcl script. The above process should ...
Prathit's user avatar
  • 27
1 vote
1 answer
47 views

Bash: How to continue for loop when condition X is satisfied

I'm trying to start a process on multiple VMs using GitHub Actions. However, the command doesn't complete (as it needs to continue running) so my for loop just kind of hangs. What I need, is a way to ...
Tijmen's user avatar
  • 551
1 vote
1 answer
74 views

Create an alias in bashrc file [duplicate]

In Linux terminal, normally I can copy files from another unix server using: scp -r [email protected]:/data/filename ./ which secure copies the remote file to my current directory. I've made sure ...
Leo's user avatar
  • 37
0 votes
3 answers
81 views

Pass multiple arguments to single command in custom position xargs

I want execute a command where I have the args as single string but they need to be in a custom position. E.g. in the following example I want the args to be positioned before any fixed args that I ...
David Nguyen's user avatar
0 votes
2 answers
75 views

create a variable using a value of another variable and store value into the newly created variable in shell/bash script [duplicate]

I am trying to create a Variable from value of another variable and trying to store value into the created variable in Shell Script. For Example: Let there is a existing variable i=1 I am trying to ...
Muhammad Mekayel Anik's user avatar
2 votes
2 answers
73 views

Regex using Bash metacharacters in double bracket `[[…]]` command using `=~` operator

The Bash reference manual, in sec. 3.2.5.2 Conditional Constructs, says It is sometimes difficult to specify a regular expression properly without using quotes, or to keep track of the quoting used ...
the_eraser's user avatar

15 30 50 per page
1
2 3 4 5
2599