Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

-2 votes
2 answers
74 views

Why does the for loop in this shell script perform the first iteration twice before doing the second one? [closed]

I have a bash script: #! usr/bin/env bash # test bash script to call python scripts cd ~/python for ((i = 1; i <= 2; i++)); do python3 test_0$i.py; done cd ~/bash that pulls test_0x.py files ...
Girish Manjunath's user avatar
1 vote
1 answer
137 views

Looking for a way to open a shell inside a running Linux Subsystem on Windows

Is there a way to open an interactive shell inside a running Windows Subsystem for Linux process? I am not planning to do anything there, I'm just learning docker right now, so I am investigating some ...
Basti's user avatar
  • 692
0 votes
1 answer
47 views

Go is not found when a shell is executed on WSL starting

I am trying to start wsl and inject a sh to run on the starting, something like this: wsl --cd /path/to/script/ -e sh script.sh and I am getting this: ./script.sh: 48: go: not found on the line 48 of ...
Eloy Fernández Franco's user avatar
1 vote
1 answer
49 views

How to pass an argument to Bash fucntion

I have a simple code, where I try to pass arguments in for to another function and get result. I run ./my_script.sh 1 2 3 4 #!/bin/bash function multi { local ax=$1 local result=$(($ax + $ax)) ...
DeBug's user avatar
  • 25
0 votes
1 answer
19 views

how to grep using linux [duplicate]

I have this line {"_class":"hudson.security.csrf.DefaultCrumbIssuer","crumb":"acb6ecf3f5e2e90d6de6695a","crumbRequestField":"Jenkins-Crumb"} ...
Mohamed Farag's user avatar
1 vote
2 answers
74 views

bash script failing with additional charactors "\r"

I'm running a script from Ubuntu 22 (WSL), and it was functioning OK until it suddenly stopped. This script connects to remote servers and collects data via ssh using ssh-pass the code with the issue ...
vijayedm's user avatar
1 vote
1 answer
343 views

route.exe: command not found in bashrc - Ubuntu 20.04

I have an issue with route.exe in the bashrc of ubuntu. Basically I am using ubuntu 20.04 in wsl in windows. I am trying to get the ip using the route.exe. It was working fine earlier but now it is ...
Rony Shaji's user avatar
2 votes
1 answer
1k views

Remove-Item does not delete folder

I need to delete a folder, but I get error can't remove because directory is not empty I used this command : Remove-Item \\wsl.localhost\Debian\home\my_folder_to_delete -Recurse -Force How can I ...
Johan's user avatar
  • 2,684
1 vote
1 answer
165 views

Getting different results when using shell operators -ne and != [duplicate]

I wrote the below shell script, when using -ne it gives the result Synced but also with a warning message : integer expression expected. When I use != it gives NotSynced... Is PowerShell's datetime ...
Ali Abdi's user avatar
  • 418
0 votes
3 answers
355 views

How can I replace all occurrences of a value in a text file just in one column using the Sed command in shell script (columns are seperated by ;)? [duplicate]

I have a file that has columns seperated by a semi column(;) and I want to change all occurrences of a word in a particular column only to another word. The column number differentiates based on the ...
AymanSalama's user avatar
0 votes
2 answers
1k views

Syntax error: end of file unexpected (expecting "}")

I am running the following script within a longer html file report_home_space () { cat <<- _EOF_ <h2>Home Space Utilization</h2> <pre>$(du -sh /home/*)</pre> _EOF_ ...
Ajeje's user avatar
  • 33
1 vote
0 answers
78 views

WSL2 Ubuntu Python 3.10.4 interpreter sees quotation mark as a syntax error

> python record_data.py --browser chrome --num_runs 1 --sites_list google.com --trace_length 5 File "record_data.py", line 125 response = input(f"{prompt} [y/N] ") ...
koezgen's user avatar
  • 21
0 votes
0 answers
112 views

shell script capture variable without formatting escape characters

I am running an .sh script from wsl bash. Inside the script I want capture a file path, into a variable, in order to pass it to cmd.exe like so: my_win_path=<some_windows_unc_path_to_executable> ...
sogrady's user avatar
0 votes
1 answer
61 views

setting arguments in bash(trying to run script and no output)

I have script that needs to check if the file is exists and additionally set up arguments. From user side user runs a script and checks if the file exists ./xxx.sh -f folder/file and then prints out ...
user avatar
0 votes
2 answers
431 views

Shell Script (not bash) : How to redirect script into su root?

Regarding su root -c '/some/foo/command' <<<'somepass', we can't use string input redirection in shell (not bash) env. My box is alpine on WSLv2, so security isn't an issue as it's a windows +...
Benyamin Limanto's user avatar

15 30 50 per page
1
2 3 4 5 6