{"id":2768,"date":"2025-12-24T10:00:34","date_gmt":"2025-12-24T15:00:34","guid":{"rendered":"https:\/\/www.mymiller.name\/wordpress\/?p=2768"},"modified":"2025-12-24T10:00:34","modified_gmt":"2025-12-24T15:00:34","slug":"shell-script-command-line-arguments","status":"publish","type":"post","link":"https:\/\/www.mymiller.name\/wordpress\/misc\/shell-script-command-line-arguments\/","title":{"rendered":"Shell Script Command Line Arguments"},"content":{"rendered":"\n<p>Obviously you do not want to add your Username\/Password to scripts so how can you enter those and make use of execute_cmd and sftp_file without them?&nbsp; Simple provide them as command line arguments in your master script that organizes all the steps.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nusage() {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo \"Usage: $0 &#91;-u &lt;username&gt;] &#91;-p &lt;passwrd&gt;]\" 1&gt;&amp;2\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo \"-u Intranet Password\" 1&gt;&amp;2\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo \"-p Intranet Password\" 1&gt;&amp;2\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit 1\n&nbsp;}\n\nwhile getopts \"u:p:\" o; do\n&nbsp;&nbsp;&nbsp; case \"${o}\" in\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; u)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; username=${OPTARG}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password=${OPTARG}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usage\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp; esac\ndone\n\nshift $((OPTIND-1))\n\nif &#91; \"$samepwd\" = true ] ; then\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ftppassword=${password}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ftpid=${username}\nfi\n\nif &#91; -z \"${username}\" ] || &#91; -z \"${password}\" ]; then\n&nbsp;&nbsp;&nbsp; usage\nfi\n\necho Username: ${username}\necho Passsword: ${password}<\/code><\/pre>\n\n\n\n<p>Usage:&nbsp; command_name&nbsp; -u -p<\/p>\n\n\n\n<p>Now you can extend this out, and when I get a chance I&#8217;ll do another post on how to add additional arguments to this script.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Obviously you do not want to add your Username\/Password to scripts so how can you enter those and make use of execute_cmd and sftp_file without them?&nbsp; Simple provide them as command line arguments in your master script that organizes all the steps. Usage:&nbsp; command_name&nbsp; -u -p Now you can extend this out, and when I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3164,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[10],"tags":[],"series":[],"class_list":["post-2768","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-misc"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2022\/01\/bash-g44a7c159f_640.png?fit=640%2C506&ssl=1","jetpack-related-posts":[{"id":3395,"url":"https:\/\/www.mymiller.name\/wordpress\/springboot\/spring-profiles-and-yaml\/","url_meta":{"origin":2768,"position":0},"title":"Spring Profiles and YAML","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Configuration management is a critical aspect of building robust applications. Spring Boot simplifies configuration handling by supporting various file formats, including YAML. YAML (YAML Ain't Markup Language) offers a human-readable and concise syntax, making it an excellent choice for configuring Spring Boot applications. In this article, we will explore how\u2026","rel":"","context":"In &quot;Springboot&quot;","block_context":{"text":"Springboot","link":"https:\/\/www.mymiller.name\/wordpress\/category\/springboot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/icon-gc4bfcbaa4_640.png?fit=640%2C640&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/icon-gc4bfcbaa4_640.png?fit=640%2C640&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/icon-gc4bfcbaa4_640.png?fit=640%2C640&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3757,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_databases\/connecting-to-multiple-mongodb-databases-with-spring-data\/","url_meta":{"origin":2768,"position":1},"title":"Connecting to Multiple MongoDB Databases with Spring Data","author":"Jeffery Miller","date":"December 23, 2025","format":false,"excerpt":"Modern applications, especially in a microservices architecture, often require interaction with multiple databases. This is particularly common with NoSQL databases like MongoDB, where different services might have their own dedicated databases. Spring Data MongoDB simplifies the management of multiple MongoDB datasources within your application. This article provides a comprehensive guide\u2026","rel":"","context":"In &quot;Spring Databases&quot;","block_context":{"text":"Spring Databases","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_databases\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/ai-generated-8180209_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/ai-generated-8180209_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/ai-generated-8180209_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/ai-generated-8180209_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/ai-generated-8180209_1280-jpg.avif 3x"},"classes":[]},{"id":3744,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_config\/3744\/","url_meta":{"origin":2768,"position":2},"title":"Spring Cloud Config: Choosing the Right Backend Storage","author":"Jeffery Miller","date":"December 23, 2025","format":false,"excerpt":"Spring Cloud Config offers a flexible way to manage your application\u2019s configuration. A crucial step is selecting the right backend to store your configuration data. Let\u2019s explore popular options, their pros and cons, configuration details, and the necessary dependencies for Maven and Gradle. 1. Git Pros: Version Control: Leverage Git\u2019s\u2026","rel":"","context":"In &quot;Spring Config&quot;","block_context":{"text":"Spring Config","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_config\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/04\/woman-8696271_640.jpg?fit=438%2C640&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3816,"url":"https:\/\/www.mymiller.name\/wordpress\/spring\/securing-your-spring-boot-actuator-endpoints-a-comprehensive-guide\/","url_meta":{"origin":2768,"position":3},"title":"Securing Your Spring Boot Actuator Endpoints: A Comprehensive Guide","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Spring Boot Actuator provides invaluable insights into the inner workings of your running application. From health checks and metrics to thread dumps and environment details, these endpoints are crucial for monitoring and managing your application in production. However, exposing them without proper security can open doors to malicious actors, potentially\u2026","rel":"","context":"In &quot;Spring&quot;","block_context":{"text":"Spring","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif 3x"},"classes":[]},{"id":3692,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_aop\/tracking-method-access-in-spring-aop-security-and-jpa\/","url_meta":{"origin":2768,"position":4},"title":"Tracking Method Access in Spring: AOP, Security, and JPA","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"In the world of Spring applications, understanding how your methods are accessed can be crucial for various reasons like monitoring usage patterns, auditing security, or simply gathering insights into your application\u2019s behavior. Let\u2019s explore a powerful approach to track method access using Spring AOP (Aspect-Oriented Programming), Spring Security, and Spring\u2026","rel":"","context":"In &quot;Spring AOP&quot;","block_context":{"text":"Spring AOP","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_aop\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/money-3523131_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/money-3523131_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/money-3523131_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/money-3523131_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/money-3523131_1280-jpg.avif 3x"},"classes":[]},{"id":3747,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_config\/secure-your-secrets-encrypting-values-with-spring-cloud-config\/","url_meta":{"origin":2768,"position":5},"title":"Secure Your Secrets: Encrypting Values with Spring Cloud Config","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"In the world of microservices, Spring Cloud Config provides a centralized way to manage externalized configurations for your applications. But what about sensitive data like database passwords or API keys? That\u2019s where encryption comes in. This blog post will guide you through the process of encrypting your sensitive values using\u2026","rel":"","context":"In &quot;Spring Config&quot;","block_context":{"text":"Spring Config","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_config\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/security-5726869_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/security-5726869_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/security-5726869_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/security-5726869_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/security-5726869_1280-jpg.avif 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2768","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/comments?post=2768"}],"version-history":[{"count":2,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2768\/revisions"}],"predecessor-version":[{"id":3165,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2768\/revisions\/3165"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media\/3164"}],"wp:attachment":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media?parent=2768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/categories?post=2768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/tags?post=2768"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/series?post=2768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}